String Character Length: Difference between revisions
Content deleted Content added
Undo revision 7913 by Special:Contributions/SdqZt5 (User talk:SdqZt5) |
mNo edit summary |
||
Line 59:
char *p = (char *) string;
while (*p
return 0;
Line 93:
}
==[[C plus plus|C
[[Category:C plus plus|C
'''Standard:''' [[ISO C plus plus|ISO C
'''Compiler:''' g
#include <string> // note: '''not''' <string.h>
Line 124:
'''Platform:''' [[.NET]]
'''Language Version:''' 1.0
string s = "Hello, world!";
Line 172:
binary
: utf8
begin
char
dup c@
11000000 and
Line 186:
swap dup c@
while
utf8
swap 1
repeat drop ;
Line 216:
Since Java 1.5, the actual number of characters can be determined by calling the codePointCount method.
String str = "\uD834\uDD2A"; //U
int length1 = str.length(); //2
int length2 = str.codePointCount(0, str.length()); //1
Line 229:
var len1 = str1.length; //13
var str2 = "\uD834\uDD2A"; //U
var len2 = str2.length; //2
|