HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

quick string question

07-19-2004, 07:03 PM#1
bile
I'm not sure how this works so that's why i ask this question. Even if it is kind of newbish, can someone help me out?

I'm trying to save parts of entered messages to variables. For example a player types in "bubba joe" and i want to save the word "joe" he typed in to a string variable.

the only thing i see in the editer is "substring(String,1,2)". would the "String" part of that be changed to Entered Chat string and the 1 and 2 being the position of the entered chat string there i want (1 being the beginning of where it saves and 2 being where it ends)? Or am i totally off here? I've almost no idea what i need here.
Is every character numbered or something there?
07-19-2004, 07:19 PM#2
johnfn
Ok. Say that each character of a string is numbered (you hit the nail on the head at the last statement). In the string "a test", a would be the 1st character, t would be the 3es (and the 6th) When you take a substring you get the characters between the characters numbered by the numbers 1 and 2. For example if you took the substring of "hello" from 2 to 4 you would get ell. Easy as that.

As the last example, Bubba joe substringed so you would get just joe would be substring ("bubba joe", 7, 9).

Hope thats what you want.
07-19-2004, 07:30 PM#3
bile
Yes, thank you. I understand now.