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

  • Replace empty strings by a zero width space (Unicode 0x200B).
  • Replace all UTF-8 letters by their (Unicode) tags <0xXXXX>.
  • If the strings begins with %!TT, remove the ParaStyle right behind %!TT.
  • Replace all other ParaStyles by paragraph delimiters (hard returns).
  • Remove all remaining TaggedText tags.
  • Replace every double quota by " and every singe quota by '.
  • Replace every blank (Unicode 0x2000 - 0x200F) by space.
  • Replace every hyphenation sign (Unicode 0x2010 - 0x2016) by minus.
Preconditions
#include "internal/text.h"

Since
netWeight since v3.2.3 R2600, 08.08.2011

Available
priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

See Also
strncmp
textcmp
textncmp

Alphabetic index HTML hierarchy of classes or Java