Thread
:
[USEFUL FUNCTION] StrToBool
View Single Post
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
05-19-2007 , 13:48 Re: [USEFUL FUNCTION] StrToBool
#
8
Quote:
Originally Posted by
sslice
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
View Public Profile
Send a private message to PM
Visit PM's homepage!
Find More Posts by PM