[ Solved ]switch string
How to ?
PHP Code:
|
Re: switch string
Please explain more accuratly what do you want...
|
Re: switch string
how to switch a string value like
PHP Code:
if(equal(g_Adminrank,"Basic Moderator")){ // Bla bla } i wan't to make it in a switch like this switch(g_Adminrank){ case 'Basic Moderator': // Bla bla |
Re: switch string
You can not, as the switch statement only accepts integer values.
|
Re: switch string
how about doing it with enum ?
|
Re: switch string
How about testing it before asking for help?
|
Re: switch string
how about shut the fuck up . and don't put a post just for spam or '...' .
|
Re: switch string
Dude, I haven't insulted you in anyway.
If you test it yourself you would have had the result. Should it be a success, you got for yourself a solution. If no, you can post what you have done and others can help you with an appropriate and efficient way to solve your problem. You win in anyway and definitely faster than just waiting for someone to answer your random question. So stop being a dick and start testing. |
Re: switch string
If you wan't to help just post it i will be appreciated . but if its out of the object just leave .
Because you don't help me at all . Thanks , [ Solved using enumeration ] . |
Re: [ Solved ]switch string
An enum doesn't satisfy what you are requesting in post #3. However, the best you could do is use a Trie to get an integer (that is associated with the input string) to use in your switch.
Based on the purpose of the code in post #1, you should be using integers or enums anyways. I'm glad you found the answer. All 'good' scripters try stuff on their own before asking "will this work" unless it's extremely complicated. |
| All times are GMT -4. The time now is 15:23. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.