Clojure - 反轉字串



反轉字串中的字元。

語法

以下是語法。

(reverse str)

引數 - 'str' 是需要反轉的字串。

返回值 - 反轉後的字串。

示例

以下是 Clojure 中 reverse 的示例。

(ns clojure.examples.hello
   (:gen-class))
(defn hello-world []
   (println (reverse "Hello World")))
(hello-world)

輸出

以上程式產生以下輸出。

(d l r o W   o l l e H)                                                        
clojure_strings.htm
廣告
© . All rights reserved.