Raised This Month: $ Target: $400
 0% 

[USEFUL FUNCTION] StrToBool


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
sslice
Senior Member
Join Date: Feb 2005
Location: Texas, USA
Old 05-19-2007 , 00:24   Re: [USEFUL FUNCTION] StrToBool
Reply With Quote #7

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.
__________________
sslice is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode