ubit
Static Public Member Functions | List of all members
ubit::UCstr Struct Reference

useful functions for C strings. More...

#include <ustr.hpp>

Static Public Member Functions

static char * dup (const char *s)
 creates a duplicate of s.
 
static char * dup (const char *s1, const char *s2)
 creates a duplicate of s1 + s2.
 
static char * dup (const char *s1, char sep, const char *s2)
 creates a duplicate of s1 + sep + s2.
 
static bool equals (const char *s1, const char *s2, bool ignore_case=false)
 checks if string contents are the same, ignores case if last argument is true.
 
static int compare (const char *s1, const char *s2, bool ignore_case=false)
 compare strings lexicographically, ignores case if last argument is true.
 
static int compareN (const char *s1, const char *s2, unsigned int n, bool ignore_case=false)
 compare the N first chars of strings, ignores case if last argument is true.
 
static const char * suffix (const char *pathname)
 finds the suffix in a pathname. More...
 
static void parsePath (char *path_name, int path_len, char *&dir_name, int &dir_len, char *&base_name, int &base_len, char *&suffix, int &suffix_len)
 transforms a path name into its dirname, basename and suffix components. More...
 

Detailed Description

useful functions for C strings.

these functions may already exist on some OS.

Member Function Documentation

§ parsePath()

void UCstr::parsePath ( char *  path_name,
int  path_len,
char *&  dir_name,
int &  dir_len,
char *&  base_name,
int &  base_len,
char *&  suffix,
int &  suffix_len 
)
static

transforms a path name into its dirname, basename and suffix components.

the returned pointers points inside the path name and should not be freed.

§ suffix()

const char * UCstr::suffix ( const char *  pathname)
static

finds the suffix in a pathname.

the returned value is null or points inside the original string (its is not duplicated and thus, can't be freed)


The documentation for this struct was generated from the following files: