当前位置: 首页 > 文档资料 > Clojure 中文教程 >

trim

优质
小牛编辑
117浏览
2023-12-01

从字符串的两端删除空格。

语法 (Syntax)

以下是语法。

(trim str)

Parameters - 'str'是输入字符串。

Return Value - 删除了空格的字符串。

例子 (Example)

以下是Clojure中的修剪示例。

(ns clojure.examples.hello
   (:gen-class))
(defn hello-world []
   (println (clojure.string/trim " White spaces ")))
(hello-world)

输出 (Output)

上述程序产生以下输出。

White spaces