LibRCG  3.1.1
rstring.h File Reference

Implementation of functions to manipulate strings. More...

Go to the source code of this file.

Functions

int trimStart (char *str)
 Removes leading whitespaces of a string. More...
 
int trimEnd (char *str)
 Removes trailing whitespaces of a string. More...
 
int trim (char *str)
 Removes leading and trailing whitespaces of a string, as well as consecutive whitespaces in the middle of a string. More...
 
int charElem (char c, const char *str)
 Checks if there is an occurrence of a specific character in a string. More...
 
List words (const char *str)
 Given a string, computes the list of words that the string contains. More...
 
List strSep (const char *str, const char *delim)
 Splits a string. More...
 

Detailed Description

Implementation of functions to manipulate strings.

Author
Rui Carlos Gonçalves
Version
3.0
Date
05/2012

Definition in file rstring.h.

Function Documentation

int charElem ( char  c,
const char *  str 
)

Checks if there is an occurrence of a specific character in a string.

Parameters
cthe character
strthe string
Returns
1 if there is an occurrence of the character in the string
0 otherwise

Definition at line 85 of file rstring.c.

List strSep ( const char *  str,
const char *  delim 
)

Splits a string.

Computes a list of strings, each of which is a substring of the string formed by splitting it on the boundaries defined by the specified delimiters (delim).

See Also
List
Parameters
strthe string
delimthe delimiters
Returns
NULL if an error occurred
the list of words resulting from splitting the string at occurrences of the specified delimiters

Definition at line 138 of file rstring.c.

int trim ( char *  str)

Removes leading and trailing whitespaces of a string, as well as consecutive whitespaces in the middle of a string.

Parameters
strthe string
Returns
the size of the resulting string

Definition at line 54 of file rstring.c.

int trimEnd ( char *  str)

Removes trailing whitespaces of a string.

Parameters
strthe string
Returns
the size of the resulting string

Definition at line 37 of file rstring.c.

int trimStart ( char *  str)

Removes leading whitespaces of a string.

Parameters
strthe string
Returns
the size of the resulting string

Definition at line 14 of file rstring.c.

List words ( const char *  str)

Given a string, computes the list of words that the string contains.

The original string is not changed.

See Also
List
Parameters
strthe string
Returns
NULL if an error occurred
the list of words otherwise

Definition at line 100 of file rstring.c.

LibRCG © 2004-2015   Rui Carlos Gonçalves