Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/putil/string_utils.h File Reference

#include <pandabase.h>
#include <string>
#include <vector_string.h>
#include "string_utils.I"

Go to the source code of this file.

Functions

EXPCL_PANDA int cmp_nocase (const string &s, const string &s2)
EXPCL_PANDA int cmp_nocase_uh (const string &s, const string &s2)
EXPCL_PANDA string downcase (const string &s)
 Returns the input string with all uppercase letters converted to lowercase.

EXPCL_PANDA string upcase (const string &s)
 Returns the input string with all lowercase letters converted to uppercase.

EXPCL_PANDA int extract_words (const string &str, vector_string &words)
 Divides the string into a number of words according to whitespace.

EXPCL_PANDA void tokenize (const string &str, vector_string &words, const string &delimiters)
 Chops the source string up into pieces delimited by any of the characters specified in delimiters.

EXPCL_PANDA string trim_left (const string &str)
 Returns a new string representing the contents of the given string with the leading whitespace removed.

EXPCL_PANDA string trim_right (const string &str)
 Returns a new string representing the contents of the given string with the trailing whitespace removed.

EXPCL_PANDA int string_to_int (const string &str, string &tail)
 A string-interface wrapper around the C library strtol().

EXPCL_PANDA bool string_to_int (const string &str, int &result)
 Another flavor of string_to_int(), this one returns true if the string is a perfectly valid integer (and sets result to that value), or false otherwise.

EXPCL_PANDA double string_to_double (const string &str, string &tail)
 A string-interface wrapper around the C library strtol().

EXPCL_PANDA bool string_to_double (const string &str, double &result)
 Another flavor of string_to_double(), this one returns true if the string is a perfectly valid number (and sets result to that value), or false otherwise.

EXPCL_PANDA bool string_to_float (const string &str, float &result)
 Another flavor of string_to_float(), this one returns true if the string is a perfectly valid number (and sets result to that value), or false otherwise.

template<class Thing> string format_string (const Thing &thing)


Detailed Description

Definition in file string_utils.h.


Function Documentation

EXPCL_PANDA int cmp_nocase const string &  s,
const string &  s2
 

Definition at line 29 of file string_utils.cxx.

EXPCL_PANDA int cmp_nocase_uh const string &  s,
const string &  s2
 

Definition at line 52 of file string_utils.cxx.

References toupper_uh().

Referenced by EggGroup::get_vertex_membership(), EggGroup::has_object_type(), EggGroup::set_group_type(), EggTexture::string_format(), EggGroup::test_vref_integrity(), and EggGroup::unref_vertex().

EXPCL_PANDA string downcase const string &  s  ) 
 

Returns the input string with all uppercase letters converted to lowercase.

Definition at line 80 of file string_utils.cxx.

Referenced by LoaderFileTypeRegistry::get_num_types().

EXPCL_PANDA int extract_words const string &  str,
vector_string &  words
 

Divides the string into a number of words according to whitespace.

The words vector should be cleared by the user before calling; otherwise, the list of words in the string will be appended to the end of whatever was there before.

The return value is the number of words extracted.

Definition at line 131 of file string_utils.cxx.

template<class Thing>
string format_string const Thing &  thing  )  [inline]
 

Definition at line 25 of file string_utils.I.

Referenced by GLGraphicsStateGuardian::begin_bind_clip_planes(), CRGraphicsStateGuardian::set_blend_mode(), and ParametricCurveCollection::stitch().

EXPCL_PANDA bool string_to_double const string &  str,
double &  result
 

Another flavor of string_to_double(), this one returns true if the string is a perfectly valid number (and sets result to that value), or false otherwise.

Definition at line 327 of file string_utils.cxx.

Referenced by string_to_int().

EXPCL_PANDA double string_to_double const string &  str,
string &  tail
 

A string-interface wrapper around the C library strtol().

This parses the ASCII representation of an floating-point number, and then sets tail to everything that follows the first valid integer read. If, on exit, str == tail, there was no valid integer in the source string; if !tail.empty(), there was garbage after the number.

It is legal if str and tail refer to the same string.

Definition at line 305 of file string_utils.cxx.

EXPCL_PANDA bool string_to_float const string &  str,
float &  result
 

Another flavor of string_to_float(), this one returns true if the string is a perfectly valid number (and sets result to that value), or false otherwise.

Definition at line 347 of file string_utils.cxx.

EXPCL_PANDA bool string_to_int const string &  str,
int &  result
 

Another flavor of string_to_int(), this one returns true if the string is a perfectly valid integer (and sets result to that value), or false otherwise.

Definition at line 275 of file string_utils.cxx.

Referenced by VrpnClient::do_poll(), get_command_line_filenames(), and main().

EXPCL_PANDA int string_to_int const string &  str,
string &  tail
 

A string-interface wrapper around the C library strtol().

This parses the ASCII representation of an integer, and then sets tail to everything that follows the first valid integer read. If, on exit, str == tail, there was no valid integer in the source string; if !tail.empty(), there was garbage after the integer.

It is legal if str and tail refer to the same string.

Definition at line 255 of file string_utils.cxx.

References string_to_double().

EXPCL_PANDA void tokenize const string &  str,
vector_string &  words,
const string &  delimiters
 

Chops the source string up into pieces delimited by any of the characters specified in delimiters.

Repeated delimiter characters represent zero-length tokens.

It is the user's responsibility to ensure the output vector is cleared before calling this function; the results will simply be appended to the end of the vector.

Definition at line 178 of file string_utils.cxx.

References size_t.

EXPCL_PANDA string trim_left const string &  str  ) 
 

Returns a new string representing the contents of the given string with the leading whitespace removed.

Definition at line 202 of file string_utils.cxx.

EXPCL_PANDA string trim_right const string &  str  ) 
 

Returns a new string representing the contents of the given string with the trailing whitespace removed.

Definition at line 221 of file string_utils.cxx.

EXPCL_PANDA string upcase const string &  s  ) 
 

Returns the input string with all lowercase letters converted to uppercase.

Definition at line 100 of file string_utils.cxx.

References size_t.


Generated on Fri May 2 00:46:12 2003 for Panda by doxygen1.3