CrossZeroStringUtils Namespace Reference


Functions

template<class T>
bool stringToValue (const std::string &str, T &val)


Detailed Description

CrossZeroStringUtils is utility namespace where defined functions are useful for string-operations.

Function Documentation

template<class T>
bool CrossZeroStringUtils::stringToValue ( const std::string &  str,
T &  val 
) [inline]

stringToValue is template-function which is used to convert string to number.

Parameters:
str is string which contains number (it can be real number or integer number)
val is value where number from string is converted.
Returns:
true if conversion was succesful false if not.
Example:

std::string strMyValue = "123";
int iValue = 0;
if(CrossZeroStringUtils::stringToValue(strMyValue,iValue))
std::cout<<"String is converted into value";
else
{
std::cout<<"String was not converted into value";
return; //error
}
std::cout<<"iValue is : "<<iValue; //Should print 123

Definition at line 45 of file CrossZeroStringUtils.h.

Referenced by CrossZeroHumanPlayer::getInput().

Here is the caller graph for this function:


Generated on Mon Feb 25 23:18:58 2008 for CrossZero by  doxygen 1.5.5