Logo

Programming-Idioms

History of Idiom 169 > diff from v109 to v110

Edit summary for version 110 by preveen:
New Clojure implementation by user [preveen]

Version 109

2022-06-27, 07:08:54

Version 110

2022-07-13, 14:16:41

Idiom #169 String length

Assign to the integer n the number of characters of the string s.
Make sure that multibyte characters are properly handled.
n can be different from the number of bytes of s.

Idiom #169 String length

Assign to the integer n the number of characters of the string s.
Make sure that multibyte characters are properly handled.
n can be different from the number of bytes of s.

Variables
n,s
Variables
n,s
Extra Keywords
size characters chars number runes
Extra Keywords
size characters chars number runes
Code
(defn n[s] (.codePointCount s 0 (count s)))