문제

I need to loop over the characters in a given string--in Ruby, I'd do something like this:

string = "blah"

string.each_char do |c| 

   puts c

end

How do I do this in newLisp?

도움이 되었습니까?

해결책

Note that dostring supplies integers:

(let (str "😄😃😀😊")
(dostring (c str)
  (println (format "%x" c))))

1f604
1f603
1f600
1f60a

whereas explode supplies the characters:

(let (str "😄😃😀😊")
(dolist (c (explode str))
  (println c)))

😄
😃
😀
😊

다른 팁

I figured it out:

(let (str "blah")  

   (dostring (c str)

      (println (char c) )))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top