ThingWorx C SDK
Functions
stringUtils.h File Reference

String utility function prototypes. More...

#include "string.h"

Go to the source code of this file.

Functions

char * lowercase (char *input)
 Converts a string to lowercase. More...
 
char * uppercase (char *input)
 Converts a string to uppercase. More...
 
char * duplicateString (const char *input)
 Copies a string. More...
 
char * duplicateStringN (const char *input, size_t maxlen)
 Copies a string, up to some maximum length. More...
 
int concatenateStrings (char **dest, const char *src)
 concatenates strings. More...
 
int concatenateStringsN (char **dest, const char *src, size_t maxlen)
 concatenates strings uo to a maximum length. More...
 
char stringEndsWithSuffix (const char *str, const char *suf)
 returns TRUE if str ends with suf. More...
 

Detailed Description

String utility function prototypes.

Function Documentation

int concatenateStrings ( char **  dest,
const char *  src 
)

concatenates strings.

Parameters
[in]destreference to the destination string
[in]srcpointer to string which will be appended to destination
Returns
An integer status value, TW_OK on success, error code on failure
Note
the original dest pointer will be free'd and replaced after the new memory has been allocated
int concatenateStringsN ( char **  dest,
const char *  src,
size_t  maxlen 
)

concatenates strings uo to a maximum length.

Parameters
[in]destreference to the destination string
[in]srcpointer to string which will be appended to destination
[in]maxlenThe maximum length of the resulting string, excluding the terminating null
Returns
An integer status value, TW_OK on success, error code on failure
Note
the original dest pointer will be free'd and replaced after the new memory has been allocated
char* duplicateString ( const char *  input)

Copies a string.

Deprecated:
Prefer duplicateStringN() and supply a reasonable maximum based on context
Parameters
[in]inputThe string to copy.
Returns
A copy of input.
Note
The calling function gains ownership of the returned string and retains ownership of the input string.
char* duplicateStringN ( const char *  input,
size_t  maxlen 
)

Copies a string, up to some maximum length.

Parameters
[in]inputThe string to copy.
[in]maxlenThe maximum length of the resulting string, excluding the terminating null
Returns
A copy of up to the first maxlen chars of input, with a null terminator.
Note
The calling function gains ownership of the returned string and retains ownership of the input string.
char* lowercase ( char *  input)

Converts a string to lowercase.

Parameters
[in]inputThe string to change to lowercase.
Returns
The lowercase format of input.
Note
The string is directly modified, not copied.
char stringEndsWithSuffix ( const char *  str,
const char *  suf 
)

returns TRUE if str ends with suf.

Parameters
[in]strreference to the string to search
[in]sufa string that str must end with for this function to return TRUE
Returns
TRUE if suf is present at the end of str, otherwise FALSE;
char* uppercase ( char *  input)

Converts a string to uppercase.

Parameters
[in]inputThe string to change to uppercase.
Returns
The uppercase format of input.
Note
The string is directly modified, not copied.