Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

rs::str Namespace Reference

string functions to make string/char* handling more convenient. More...


strncmp

Compare the first maxcmp characters of two strings.

Overloaded strncmp functions:

int strncmp (const std::string &s1, const char *s2, size_t maxcmp)
 Compare a string with a char*. More...

int strncmp (const char *s1, const std::string &s2, size_t maxcmp)
 Compare a char* with a string. More...

int strncmp (const std::string &s1, const std::string &s2, size_t maxcmp)
 Compare a string with a string. More...


strnicmp

Compare the first maxcmp characters of two strings (not case-sensitive)

Overloaded strnicmp functions:

int strnicmp (const char *s1, const char *s2, size_t maxcmp)
 Compare a string with a char*. More...

int strnicmp (const std::string &s1, const char *s2, size_t maxcmp)
 Compare a string with a char*. More...

int strnicmp (const char *s1, const std::string &s2, size_t maxcmp)
 Compare a char* with a string. More...

int strnicmp (const std::string &s1, const std::string &s2, size_t maxcmp)
 Compare a string with a string. More...


stricmp

Compare two strings or char* (not case-sensitive)

Overloaded stricmp functions:

int stricmp (const char *s1, const char *s2)
 Compare a string with a char*. More...

int stricmp (const std::string &s1, const char *s2)
 Compare a string with a char*. More...

int stricmp (const char *s1, const std::string &s2)
 Compare a char* with a string. More...

int stricmp (const std::string &s1, const std::string &s2)
 Compare a string with a string. More...


strscmp

Compare the start of two strings or char*

Overloaded strscmp functions:

int strscmp (const char *s1, const char *s2)
 Compare a string with a char*. More...

int strscmp (const std::string &s1, const char *s2)
 Compare a string with a char*. More...

int strscmp (const char *s1, const std::string &s2)
 Compare a char* with a string. More...

int strscmp (const std::string &s1, const std::string &s2)
 Compare a string with a string. More...


strsicmp

Compare the start of two strings or char* (not case-sensitive)

Overloaded strsicmp functions:

int strsicmp (const char *s1, const char *s2)
 Compare a string with a char*. More...

int strsicmp (const std::string &s1, const char *s2)
 Compare a string with a char*. More...

int strsicmp (const char *s1, const std::string &s2)
 Compare a char* with a string. More...

int strsicmp (const std::string &s1, const std::string &s2)
 Compare a string with a string. More...


strichr

case-insensitive strchr

Overloaded strichr functions:

const char * strichr (const char *haystack, char needle)
 case-insensitive strchr. More...

char * strichr (char *haystack, char needle)
 non-const version. More...


stristr

case-insensitive strstr

Overloaded stristr functions:

const char * stristr (const char *haystack, const char *needle)
 case-insensitive strstr. More...

char * stristr (char *haystack, const char *needle)
 non-const version. More...


strlwr/strupr

change case of string

Overloaded strlwr/strupr functions:

void strlwr (char *s)
 change case of char* to lower. More...

void strlwr (std::string &s)
 change case of string to lower. More...

void strupr (char *s)
 change case of char* to upper. More...

void strupr (std::string &s)
 change case of string to upper. More...


Functions

string vstrf (const char *format, va_list argPtr)
 Create a string via a printf-like format string. More...

string strf (const char *format,...)
 Create a string via a printf-like format string. More...

std::string cropString (const std::string &s)
 Remove spaces at start and end of string. More...

char * strdup (const std::string &s)
 Create a malloc-copy from a string. More...


Detailed Description

string functions to make string/char* handling more convenient.

Function Documentation

std::string vstrf const char *    format,
va_list    argPtr
 

Create a string via a printf-like format string.

Parameters:
format  printf-like format string
argPtr  arguments

Definition at line 38 of file Tools.cpp.

Referenced by strf().

std::string strf const char *    format,
...   
 

Create a string via a printf-like format string.

Parameters:
format  printf-like format string
...  arguments

Definition at line 65 of file Tools.cpp.

Referenced by rs::user::ask_number(), rs::user::choose(), Inifile::expectSection(), FilterArguments::FilterArguments(), Section::findOrCreateEntry(), RepeatedCmdLineArgumentOption::get_name(), rs::posix::getcwd(), Entry::getIntegerContent(), Entry::getNumericContent(), rs::handle_exception(), rs::file::loadDirectories(), rs::file::scanDir_internal(), ProgramInfo::setProgramPaths(), FilePosition::throw_Error(), Section::throw_Error(), and Entry::throw_Error().

std::string cropString const std::string &    s [inline]
 

Remove spaces at start and end of string.

Parameters:
s  string to crop
Returns:
cropped string

Definition at line 63 of file Tools.h.

char* strdup const std::string &    s [inline]
 

Create a malloc-copy from a string.

Parameters:
s  string to duplicate
Returns:
malloc-copy of s

Definition at line 76 of file Tools.h.

int strncmp const std::string &    s1,
const char *    s2,
size_t    maxcmp
[inline]
 

Compare a string with a char*.

Parameters:
s1  first string or char*
s2  second string or char*
maxcmp  how many characters should be compared
Returns:
0 if the compared parts are equal <0 if the part from s1 is smaller >0 if the part from s2 is smaller
Note:
All functions of this type

Definition at line 101 of file Tools.h.

Referenced by strncmp(), and strscmp().

int strncmp const char *    s1,
const std::string &    s2,
size_t    maxcmp
[inline]
 

Compare a char* with a string.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 113 of file Tools.h.

int strncmp const std::string &    s1,
const std::string &    s2,
size_t    maxcmp
[inline]
 

Compare a string with a string.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 121 of file Tools.h.

int strnicmp const char *    s1,
const char *    s2,
size_t    maxcmp
[inline]
 

Compare a string with a char*.

Parameters:
s1  first string or char*
s2  second string or char*
maxcmp  how many characters should be compared
Returns:
0 if the compared parts are equal <0 if the part from s1 is smaller >0 if the part from s2 is smaller
Note:
All functions of this type

Definition at line 152 of file Tools.h.

Referenced by stricmp(), stristr(), strnicmp(), and strsicmp().

int strnicmp const std::string &    s1,
const char *    s2,
size_t    maxcmp
[inline]
 

Compare a string with a char*.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 168 of file Tools.h.

int strnicmp const char *    s1,
const std::string &    s2,
size_t    maxcmp
[inline]
 

Compare a char* with a string.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 180 of file Tools.h.

int strnicmp const std::string &    s1,
const std::string &    s2,
size_t    maxcmp
[inline]
 

Compare a string with a string.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 188 of file Tools.h.

int stricmp const char *    s1,
const char *    s2
[inline]
 

Compare a string with a char*.

Parameters:
s1  first string or char*
s2  second string or char*
Returns:
0 if the strings are equal <0 if s1 is smaller >0 if s2 is smaller
See also:
All functions of this type

Definition at line 218 of file Tools.h.

Referenced by ProgramInfo::init(), and stricmp().

int stricmp const std::string &    s1,
const char *    s2
[inline]
 

Compare a string with a char*.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 234 of file Tools.h.

int stricmp const char *    s1,
const std::string &    s2
[inline]
 

Compare a char* with a string.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 252 of file Tools.h.

int stricmp const std::string &    s1,
const std::string &    s2
[inline]
 

Compare a string with a string.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 259 of file Tools.h.

int strscmp const char *    s1,
const char *    s2
[inline]
 

Compare a string with a char*.

same as strncmp (with the length of the shorter string)

Parameters:
s1  first string or char*
s2  second string or char*
Returns:
0 if the start of both strings is equal, <0 if s1 is smaller, >0 if s2 is smaller
See also:
All functions of this type

Definition at line 288 of file Tools.h.

Referenced by strscmp().

int strscmp const std::string &    s1,
const char *    s2
[inline]
 

Compare a string with a char*.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 303 of file Tools.h.

int strscmp const char *    s1,
const std::string &    s2
[inline]
 

Compare a char* with a string.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 320 of file Tools.h.

int strscmp const std::string &    s1,
const std::string &    s2
[inline]
 

Compare a string with a string.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 328 of file Tools.h.

int strsicmp const char *    s1,
const char *    s2
[inline]
 

Compare a string with a char*.

same as strnicmp (with the length of the shorter string)

Parameters:
s1  first string or char*
s2  second string or char*
Returns:
0 if the start of both strings is equal, <0 if s1 is smaller, >0 if s2 is smaller
See also:
All functions of this type

Definition at line 354 of file Tools.h.

Referenced by strsicmp().

int strsicmp const std::string &    s1,
const char *    s2
[inline]
 

Compare a string with a char*.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 369 of file Tools.h.

int strsicmp const char *    s1,
const std::string &    s2
[inline]
 

Compare a char* with a string.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 386 of file Tools.h.

int strsicmp const std::string &    s1,
const std::string &    s2
[inline]
 

Compare a string with a string.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 394 of file Tools.h.

const char* strichr const char *    haystack,
char    needle
[inline]
 

case-insensitive strchr.

Parameters:
haystack  is searched for needle
needle  is searched in haystack
Returns:
pointer to first occurance of needle (0 if not found)
See also:
All functions of this type

Definition at line 416 of file Tools.h.

Referenced by strichr(), and stristr().

char* strichr char *    haystack,
char    needle
[inline]
 

non-const version.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 429 of file Tools.h.

const char* stristr const char *    haystack,
const char *    needle
[inline]
 

case-insensitive strstr.

Parameters:
haystack  is searched for needle
needle  is searched in haystack
Returns:
pointer to first occurance of needle (0 if not found)
See also:
All functions of this type

Definition at line 451 of file Tools.h.

Referenced by stristr().

char* stristr char *    haystack,
const char *    needle
[inline]
 

non-const version.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 466 of file Tools.h.

void strlwr char *    s [inline]
 

change case of char* to lower.

Parameters:
s  the string or char* which is changed
See also:
All functions of this type

Definition at line 486 of file Tools.h.

void strlwr std::string &    s [inline]
 

change case of string to lower.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 497 of file Tools.h.

void strupr char *    s [inline]
 

change case of char* to upper.

Definition at line 506 of file Tools.h.

void strupr std::string &    s [inline]
 

change case of string to upper.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 518 of file Tools.h.


Contact me in case of errors or questions.
This documentation is powered by Doxygen.
(C) 2000-2002 Doxygen