Functions | |
template<class T> | |
bool | stringToValue (const std::string &str, T &val) |
bool CrossZeroStringUtils::stringToValue | ( | const std::string & | str, | |
T & | val | |||
) | [inline] |
stringToValue is template-function which is used to convert string to number.
str | is string which contains number (it can be real number or integer number) | |
val | is value where number from string is converted. |
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().