separating a string - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: separating a string (
/showthread.php?tid=270614)
separating a string -
GPenner - 21.07.2011
Hello everyone
I have a question, I want to separate a string and get each letter you have it.
example: string = hello
I wish the function returns h e l l o
and later I could use each letter.
Thx.
Re: separating a string -
[HiC]TheKiller - 21.07.2011
Well, if you think about how the string hello is made, it's easy just to get a single letter from the string.
For example, the string hello would be like this
pawn Код:
new string[5] = "hello";
/*
string[0] = 'h'
string[1] = 'e'
string[2] = 'l'
string[3] = 'l'
string[4] = 'o'
*/
Could you please give me a example of what it would be used for?
Re: separating a string -
GPenner - 21.07.2011
Quote:
Originally Posted by [HiC]TheKiller
Well, if you think about how the string hello is made, it's easy just to get a single letter from the string.
For example, the string hello would be like this
pawn Код:
new string[5] = "hello"; /* string[0] = 'h' string[1] = 'e' string[2] = 'l' string[3] = 'l' string[4] = 'o' */
Could you please give me a example of what it would be used for?
|
I'm making a cell phone system in TextDraw, and when the player enter a number
example: 123456 to TextDraw would flash the numbers
1
2
3
4
5
6
according to the sequence that were typed.
Thx
@ EDIT -
problem solved [HiC]TheKiller helped me. Thank you very much