char* addslashes (char * s)

Add slashes to a string when necessary.Adds a '\' in every quote ( ' ), apostrophe ( ' ) or backslash ( \ ) It's useful when working with databases, for example, because someone can try insert this caracters to try hack the application...

char* str_replace (char * str, const char * delim, const char * with)

Replace characteres in a string.Replace all occourences of *delim on *src with characteres pointed by *with. The problem with the folowing code is that the function only searches for the first caracter of *delim, ingoring the rest. Other problem is speed relacioned: note that the function ever compare the length of *with to do the correct action.

Parameters:

src String to parse
delim Character to search that will be replaced
with String to replace with

char* stripnslashes (char * s, int n)

Strip no more than 'n' slashes from a string.Strip the backslash character ( \ ) from a string, stopping after 'n' char

Parameters:

s String to parse
n Maximum number of chars to parse

Returns:

The new string, without slashes

See also:

addslashes, stripslashes

char *name = 'My another string is called \'blablabla\'';
puts(name); // will display My another string is called 'blablabla'
name = stripslashes(name, 33);
puts(name); // will display My another string is called 'blablabla'

char* stripslashes (char * str)

Strip slashes from a string.Strip the backslash character ( \ ) from a string

Parameters:

s String to parse

Returns:

The new string, without slashes

See also:

addslashes, stripnslashes

char *name = 'My another string is called \'blablabla\'';
puts(name); // will display My another string is called 'blablabla'
name = stripslashes(name);
puts(name); // will display My another string is called 'blablabla'

int strnpos (char * s, char * ch, unsigned int count)

Returns the position of a character in a string, but parses no more that 'n' chars.Parameters:

s String where the search will be done
ch Character to search
count Maximum number of chars to parse before exiting the function

See also:

strpos()

int strpos (char * s, char * ch)

Returns the position of a character in a string.Parameters:

s String where the search will be done
ch Character to search
count Maximum number of ch to search

See also:

strnpos()

char* substr (char * src, const int start, const int count)

Copy part of a string.Copy count characters from src, starting from start

Parameters:

src String to copy from
start Initial offset
count Number of chars to copy