Comparison of two char*-strings.
Comparison of two char*-strings. Alpha-numerical comparison of two strings.
The content of an empty placeholder isn't empty but a zero width space (<0x200B>).
In the following code snippet the showmessage will never reached:
textmodel::get (docText);
if (strcmp (string::get (docText), "") == 0)
{
showmessage ("Empty");
}
You must check the document text against the zero width space (UTF8 = E2 80 8B, Unicode = 200B) in this case :
textmodel::get (docText);
if (strcmp (strcmp (string::get (docText), "\xE2\x80\x8B") == 0)
{
showmessage ("Empty");
}
If you use a tagged format to retreive the document text, please use the Unicode tag of zero width space to compare :
textmodel::get (docText, ..., kExportTT);
if (strcmp (strcmp (string::get (docText), "<0x200B>") == 0)
{
showmessage ("Empty");
}
For your convenience use strcmp with parameter netWeight set to 1.
Name | Type | Default | Description |
Return | int | < 0 : s1 < s2 | |
Return | int | = 0 : s1 == s2 | |
Return | int | > 0 : s1 > s2 | |
s1, s2 | char*, char* | -, - | char*-Strings to compare |
netWeight | int | 0 | Compare the net weight strings
|
Alphabetic index HTML hierarchy of classes or Java