CL_String - ClanLib Game SDK

Home | All Classes | Grouped Classes | Index | Search

# Class CL_String

ClanLib string class. More...

Derived from: none
Derived by: none
Group: Core (System)

#include <ClanLib/core.h>

Operations:

load | Loads a string from a resource.
left | Returns the first n characters of the string
right | Returns the last n characters in the string
from_int | Converts from an integer to string.
from_float | Converts from an float to string.
from_double | Converts from an double to string.
from_bool | Returns "true" or "false" based on a boolean.
to_bool | Converts a string to a boolean.
to_int | Converts string to an integer.
to_float | Converts string to a floating point number.
to_double | Converts string to a double precision floating point number.
to_lower | Returns the string with all characters converted to lowercase.
to_upper | Returns the string with all characters converted to uppercase.
tokenize | Breaks up the string into tokens.
compare_nocase | Does a case insensitive compare of string to other string.
get_path | Returns the path part of a pathname (path+filename). If no path part is found, "." is returned.
get_filename | Returns the filename part of a pathname (path+filename). If no path part is found, the entire string is returned.
get_extension | Returns the extension path of a filename (text after the last dot). If no extension part is found, an empty string is returned.
trim_spaces | Returns a string trimmed for space characters in both ends of string.
trim_whitespace | Returns a string trimmed for whitespace characters in both ends of string.
convert_c_escapes | Return a string with C style escapes ({'\','n'}, {'\', 't'} etc.) replaced with the real escapes ('\n', '\t').

Detailed description:

!group=Core/System! !header=core.h!

This is a general purpose string class with formatting capabilities.

Example: str::string s = CL_String::format("You rock my %1, %2 (%3)", "world", name, 47);

Questions or comments, write to the ClanLib mailing list.