Unicode String Functions

Two versions of all string functions exist: one for Unicode and one for non-Unicode. Naming standards for Unicode and non-Unicode string functions are:

  • jdeSxxxxxx() indicates a Unicode string function

  • jdeZSxxxx() indicates a non-Unicode string function

Some of the replacement functions include:

Old String Functions

New String Functions Non-Unicode

New String Functions Unicode

strcpy()

jdeZStrcpy()

jdeStrcpy()

strlen()

jdeZStrlen()

jdeStrlen()

strstr()

jdeZStrstr()

jdeStrstr()

sprintf()

jdeZSprintf()

jdeSprintf()

strncpy()

jdeZStrncpy()

jdeStrncpy()

Note:

The function jdestrcpy() was in use before the migration to Unicode. The Unicode slimer changed existing jdestrcpy() to jdeStrncpyTerminate(). Going forward, developers need to use jdeStrncpyTerminate() where they previously used jdestrcpy().

Do not use traditional string functions, such as strcpy, strlen, and printf. All the jdeStrxxxxxx functions explicitly handle strings, so use character length instead of the sizeof() operator, which returns a byte count.

When using jdeStrncpy(), the third parameter is the number of characters, not the number of bytes.

The DIM() macro gives the number of characters of an array. Given "JCHAR a[10];", DIM(a) returns 10, while sizeof(a) returns 20. "strncpy (a, b, sizeof (a));" needs to become "jdeStrncpy (a, b, DIM (a));".