Forum OpenACS Q&A: Response to string size

2: Response to string size (response to 1)
Posted by Connie Hentosh on
Yes bytelength with give you the size of the UTF-8 string. (Since UTF takes 1-3 bytes to represent a character... this can be different than length which will give you the number of characters in the string).

set bytes_of_memory  [string bytelength $temp_str]
set num_of_chars  [ string length $temp_str]

Usually one needs only the number of chars in a string.