String Character Length: Difference between revisions

Content deleted Content added
LSE64
→‎[[Forth]]: "binary" not standard
Line 180: Line 180:
The following code will count the number of UTF-8 characters in a null-terminated string. It relies on the fact that all bytes of a UTF-8 character except the first have the the binary bit pattern "10xxxxxx".
The following code will count the number of UTF-8 characters in a null-terminated string. It relies on the fact that all bytes of a UTF-8 character except the first have the the binary bit pattern "10xxxxxx".


2 base !
binary
: utf8+ ( str -- str )
: utf8+ ( str -- str )
begin
begin