Strings

This section describes the string functions and explains how to use them in your applications.

In This Section

Name Description
About Strings Discusses the string functions.
About Strsafe.h Discusses the string functions in Strsafe.h.
String Reference Contains the API reference.

String Functions

Name Description
CharLower Converts a character string or a single character to lowercase. If the operand is a character string, the function converts the characters in place.
CharLowerBuff Converts uppercase characters in a buffer to lowercase characters. The function converts the characters in place.
CharNext Retrieves a pointer to the next character in a string. This function can handle strings consisting of either single- or multi-byte characters.
CharNextExA Retrieves the pointer to the next character in a string. This function can handle strings consisting of either single- or multi-byte characters.
CharPrev Retrieves a pointer to the preceding character in a string. This function can handle strings consisting of either single- or multi-byte characters.
CharPrevExA Retrieves the pointer to the preceding character in a string. This function can handle strings consisting of either single- or multi-byte characters.
CharToOem Translates a string into the OEM-defined character set.
CharToOemBuff Translates a specified number of characters in a string into the OEM-defined character set.
CharUpper Converts a character string or a single character to uppercase. If the operand is a character string, the function converts the characters in place.
CharUpperBuff Converts lowercase characters in a buffer to uppercase characters. The function converts the characters in place.
CompareString Compares two character strings, using the specified locale. Note: For compatibility with Unicode, use CompareStringEx or the Unicode version of CompareString.
CompareStringEx Compares two Unicode (wide character) strings, using the specified locale.
FoldString Maps one string to another, performing a specified transformation option.
GetStringTypeA Retrieves character-type information for the characters in the specified source string. For each character in the string, the function sets one or more bits in the corresponding 16-bit element of the output array. Each bit identifies a given character type, such as whether the character is a letter, a digit, or neither.
GetStringTypeEx Retrieves character-type information for the characters in the specified source string. For each character in the string, the function sets one or more bits in the corresponding 16-bit element of the output array. Each bit identifies a given character type, such as whether the character is a letter, a digit, or neither.
Unlike its close relatives GetStringTypeA and GetStringTypeW, GetStringTypeEx exhibits standard behavior through the use of the #define UNICODE switch. It is the recommended function.
GetStringTypeW Retrieves character-type information for the characters in the specified source string. For each character in the string, the function sets one or more bits in the corresponding 16-bit element of the output array. Each bit identifies a given character type, such as whether the character is a letter, a digit, or neither.
IsCharAlpha Determines whether a character is an alphabetical character. This determination is based on the semantics of the language selected by the user during setup or through Control Panel.
IsCharAlphaNumeric Determines whether a character is either an alphabetical or a numeric character. This determination is based on the semantics of the language selected by the user during setup or through Control Panel.
IsCharLower Determines whether a character is lowercase. This determination is based on the semantics of the language selected by the user during setup or through Control Panel.
IsCharUpper Determines whether a character is uppercase. This determination is based on the semantics of the language selected by the user during setup or through Control Panel.
LoadString Loads a string resource from the executable file associated with a specified module, copies the string into a buffer, and appends a terminating NULL character.
lstrcat Appends one string to another.
lstrcmp Compares two character strings. The comparison is case-sensitive.
lstrcmpi Compares two character strings. The comparison is not case-sensitive.
lstrcpy Copies a string to a buffer.
lstrcpyn Copies a specified number of characters from a source string into a buffer.
lstrlen Determines the length of the specified string (not including the terminating null character).
OemToChar Translates a string from the OEM-defined character set into either an ANSI or a wide-character string.
OemToCharBuff Translates a specified number of characters in a string from the OEM-defined character set into either an ANSI or a wide-character string.
wsprintf Writes formatted data to the specified buffer.
wvsprintf Writes formatted data to the specified buffer using a pointer to a list of arguments.

Strsafe Functions

Name Description
StringCbCat Concatenates one string to another string.
StringCbCatEx Concatenates one string to another string.
StringCbCatN Concatenates the specified number of bytes from one string to another string.
StringCbCatNEx Concatenates the specified number of bytes from one string to another string.
StringCbCopy Copies one string to another.
StringCbCopyEx Copies one string to another.
StringCbCopyN Copies the specified number of bytes from one string to another.
StringCbCopyNEx Copies the specified number of bytes from one string to another.
StringCbGets Gets one line of text from stdin, up to and including the newline character ('\n').
StringCbGetsEx Gets one line of text from stdin, up to and including the newline character ('\n').
StringCbLength Determines whether a string exceeds the specified length, in bytes.
StringCbPrintf Writes formatted data to the specified string.
StringCbPrintfEx Writes formatted data to the specified string.
StringCbVPrintf Writes formatted data to the specified string using a pointer to a list of arguments.
StringCbVPrintfEx Writes formatted data to the specified string using a pointer to a list of arguments.
StringCchCat Concatenates one string to another string.
StringCchCatEx Concatenates one string to another string.
StringCchCatN Concatenates the specified number of characters from one string to another string.
StringCchCatNEx Concatenates the specified number of characters from one string to another string.
StringCchCopy Copies one string to another.
StringCchCopyEx Copies one string to another.
StringCchCopyN Copies the specified number of characters from one string to another.
StringCchCopyNEx Copies the specified number of characters from one string to another.
StringCchGets Gets one line of text from stdin, up to and including the newline character ('\n').
StringCchGetsEx Gets one line of text from stdin, up to and including the newline character ('\n').
StringCchLength Determines whether a string exceeds the specified length, in characters.
StringCchPrintf Writes formatted data to the specified string.
StringCchPrintfEx Writes formatted data to the specified string.
StringCchVPrintf Writes formatted data to the specified string using a pointer to a list of arguments.
StringCchVPrintfEx Writes formatted data to the specified string using a pointer to a list of arguments.