Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

SysUtils


Files

file  psString.h
 -*- mode: C; c-basic-indent: 4; tab-width: 8; indent-tabs-mode: nil -*- vim: set cindent ts=8 sw=4 expandtab:Contains the declarations of string utility functions

Functions

psString psStringCopy (const char *string)
 Copies the input string.
psString psStringNCopy (const char *string, unsigned int nChar)
 Copies the input string up to the specified number of characters.
ssize_t psStringAppend (char **dest, const char *format,...)
 Appends a format onto a string.
ssize_t psStringPrepend (char **dest, const char *format,...)
 Prepends a format onto a string.
psListpsStringSplit (const char *string, const char *splitters, bool multipleAreSignificant)
 Procedure to split the input string into a psList of psStrings.
psArraypsStringSplitArray (const char *string, const char *splitters, bool multipleAreSignificant)
 Procedure to split the input string into a psArray of psStrings.
char * psStringSubstitute (char *input, const char *replace, const char *key)
 Procedure to search an input string and substitute strings where desired.
size_t psStringStrip (char *string)
 Procedure to strip the whitespace from the head and tail of a string.


Function Documentation

ssize_t psStringAppend char **  dest,
const char *  format,
  ...
 

Appends a format onto a string.

This function shall allocate a new string if dest is NULL. dest shall be automatically extended to the size of the new string.

Returns:
ssize_t: The length of the new string (excluding '')
Parameters:
dest  existing string
format  format to append

psString psStringCopy const char *  string  ) 
 

Copies the input string.

This function shall allocate memory to the length of the input string plus one and copy the input string to the newly allocated memory. If 'string' is 'NULL' then 'NULL' is returned.

Returns:
psString: Copy of input string
Parameters:
string  Input string of characters to copy

psString psStringNCopy const char *  string,
unsigned int  nChar
 

Copies the input string up to the specified number of characters.

This function shall allocate memory to the length specified by nChar plus one and copy the input string to the newly allocated memory. This function will only copy nChar bytes from the input to new string, so if the input string is larger than nChar characters the copied string will be a substring of the input string. If the input string is smaller than nChar bytes then the remaining bytes allocated will be set to NULL. If 'string' is 'NULL' then 'NULL' is returned.

Returns:
psString: Copy of input string
Parameters:
string  Input string of characters to copy
nChar  Number of bytes to allocate for string copy

ssize_t psStringPrepend char **  dest,
const char *  format,
  ...
 

Prepends a format onto a string.

This function shall allocate a new string if dest is NULL. dest shall be automatically extended to the size of the new string.

Returns:
ssize_t: The length of the new string (excluding '')
Parameters:
dest  existing string
format  format to append

psList* psStringSplit const char *  string,
const char *  splitters,
bool  multipleAreSignificant
 

Procedure to split the input string into a psList of psStrings.

The string is split at any one of the characters in splitters. Split strings of zero length should not be included in the output list.

Returns:
psList*: The list of (split) psStrings.
Parameters:
string  String to split
splitters  Characters on which to split
multipleAreSignificant  Are multiple occurences significant?

psArray* psStringSplitArray const char *  string,
const char *  splitters,
bool  multipleAreSignificant
 

Procedure to split the input string into a psArray of psStrings.

The string is split at any one of the characters in splitters. Split strings of zero length should not be included in the output list.

Returns:
psArray*: The array of (split) psStrings.
Parameters:
string  String to split
splitters  Characters on which to split
multipleAreSignificant  Are multiple occurences significant?

size_t psStringStrip char *  string  ) 
 

Procedure to strip the whitespace from the head and tail of a string.

Returns:
size_t: Number of whitespaces removed.
Parameters:
string  input string to be stripped.

char* psStringSubstitute char *  input,
const char *  replace,
const char *  key
 

Procedure to search an input string and substitute strings where desired.

The input string is searched for all instances of the key, which is then replaced with the replacement value wherever found. The input string may be freed if not needed.

Returns:
char*: the modified input string.
Parameters:
input  input string to be modified
replace  replacement value
key  string to be replaced in input


Generated on Mon Jul 3 14:15:14 2006 for Pan-STARRS Foundation Library by  doxygen 1.4.4