string_length


string_length(s)
      

Return the number of characters in the string s.

Examples:

By default string_length will return the number of bytes that make up the string:


string_length("hello, world")
// 12          
string_length("您好世界")
// 12
      

If character input is set to a particular character encoding, string_length will count and report the number of characters encoded into a string. For example, if the REPL is started with the command line option -:t8,-8, which set both the terminal and standard input to UTF-8 encoding, we get the following results:


string_length("hello, world")
// 12          
string_length("您好世界")
// 4
      

Also see:

count


Core Module Index | Contents