View Single Post
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 05-19-2007 , 13:48   Re: [USEFUL FUNCTION] StrToBool
Reply With Quote #8

Quote:
Originally Posted by sslice View Post
Something like this is really dependent on the input.. could deal with 'true' and 'false', 'T' and 'F', 'yes' and 'no', etc. etc... for ConVars it would just recognize 1 and 0... and the double 'not' trick is used to convert it to boolean (to handle values other than 1 and 0).
Code:
bool:b = !!StringToInt(str);
Just depends on what you are using StrToBool() for in the end.
I think (expression ? true : false) is less cryptic but you decide
__________________
hello, i am pm
PM is offline