Hi there
I wanna do string manipulation for coding my game in an easier way.
There is why i need it.
I have a basic inventory, okay, no problem (at the moment ) for that.
I have weapons which i recognize them with ID's example:
1=Pistol
2=Flamethrower
3=Rocket-Launcher
I have a string object and i do these conditions:
• If WeaponID = 1
==> Set weaponName to "Pistol"
• If WeaponID = 2
==> Set weaponName to "Flamethrower"
• If WeaponID = 3
==> Set weaponName to "Rocket-Launcher"
And i'm gonna make a LOT of weapons in this game so i don't want to do one condition (or more maybe) for one weapon
i want to store a string in an object like:
" 1=Pistol;2=Flamethrower;3=Rocket-Launcher "
and an extension (like String parser or string tokeniser i guess) and this extension would do:
• Always (For example)
==> set weaponName to (String parser => for each piece of string (delimited by ";") => find weaponID and set it's 'value' (delimited by "="))
I practised it,searched and i can't find the solution. Thanks for helping guys and cya !