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

# Ogre::StringUtil Class Reference

Utility class for manipulating Strings. More...

`#include <OgreString.h>`

List of all members.

## Public Types

typedef std::stringstream | StrStreamType

## Static Public Methods

void | trim (String &str, bool left=true, bool right=true)
| Removes any whitespace characters, be it standard space or TABs and so on.
std::vector< String > | split (const String &str, const String &delims="\t\n", unsigned int maxSplits=0)
| Returns a StringVector that contains all the substrings delimited by the characters in the passed `delims` argument.
void | toLowerCase (String &str)
| Upper-cases all the characters in the string.
void | toUpperCase (String &str)
| Lower-cases all the characters in the string.
Real | toReal (const String &str)
| Converts the contents of the string to a Real.
bool | startsWith (const String &str, const String &pattern, bool lowerCase=true)
| Returns whether the string begins with the pattern passed in.
bool | endsWith (const String &str, const String &pattern, bool lowerCase=true)
| Returns whether the string ends with the pattern passed in.

## Static Public Attributes

const String | BLANK = String("")
| Constant blank string, useful for returning by ref where local does not exist.

## Detailed Description

Utility class for manipulating Strings.

Definition at line 85 of file OgreString.h.

## Member Typedef Documentation

typedef std::stringstream Ogre::StringUtil::StrStreamType

| Definition at line 88 of file OgreString.h.

## Member Function Documentation

bool Ogre::StringUtil::endsWith | ( | const String & | str,
|  | const String & | pattern,
|  | bool | lowerCase = true
| ) | `[static]`

Returns whether the string ends with the pattern passed in.

Parameters:

  pattern | The pattern to compare with.
  lowerCase | If true, the end of the string will be lower cased before comparison, pattern should also be in lower case.

Definition at line 145 of file OgreString.cpp.

References Ogre::String.

std::vector< String > Ogre::StringUtil::split | ( | const String & | str,
|  | const String & | delims = "\t\n",
|  | unsigned int | maxSplits = 0
| ) | `[static]`

Returns a StringVector that contains all the substrings delimited by the characters in the passed `delims` argument.

Parameters:

  delims | A list of delimiter characters to split by
  maxSplits | The maximum number of splits to perform (0 for unlimited splits). If this parameters is > 0, the splitting process will stop after this many splits, left to right.

Definition at line 66 of file OgreString.cpp.

References Ogre::String.

bool Ogre::StringUtil::startsWith | ( | const String & | str,
|  | const String & | pattern,
|  | bool | lowerCase = true
| ) | `[static]`

Returns whether the string begins with the pattern passed in.

Parameters:

  pattern | The pattern to compare with.
  lowerCase | If true, the end of the string will be lower cased before comparison, pattern should also be in lower case.

Definition at line 131 of file OgreString.cpp.

References Ogre::String.

void Ogre::StringUtil::toLowerCase | ( | String & | str | ) | `[static]`

| Upper-cases all the characters in the string. Definition at line 107 of file OgreString.cpp. References Ogre::String.

Real Ogre::StringUtil::toReal | ( | const String & | str | ) | `[static]`

Converts the contents of the string to a Real.

Remarks:
  Assumes the only contents of the string are a valid parsable Real. Defaults to a value of 0.0 if conversion is not possible.

Definition at line 126 of file OgreString.cpp.

References Ogre::Real, and Ogre::String.

void Ogre::StringUtil::toUpperCase | ( | String & | str | ) | `[static]`

| Lower-cases all the characters in the string. Definition at line 117 of file OgreString.cpp. References Ogre::String.

void Ogre::StringUtil::trim | ( | String & | str,
|  | bool | left = true,
|  | bool | right = true
| ) | `[static]`

Removes any whitespace characters, be it standard space or TABs and so on.

Remarks:
  The user may specify wether they want to trim only the beginning or the end of the String ( the default action is to trim both).

Definition at line 35 of file OgreString.cpp.

References Ogre::String.

## Member Data Documentation

const String Ogre::StringUtil::BLANK = String("")`[static]`

| Constant blank string, useful for returning by ref where local does not exist. Definition at line 33 of file OgreString.cpp.

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

- OgreString.h
- OgreString.cpp

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:51:42 2004