| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|||
|
hey im trying to figure out if theres a way to separate a string into individual characters...
I'm trying to write a hangman program so if anyone has any ideas? |
|
|||
|
sub("???",begin,length
the "???" is the string, it can be typed out or it can be str1,str2 etc begin is the character to start on ex 2 will start on the second character length is how many characters it goes example: sub("abcdefghijklmnopqrstuvwxyz",3,3 will give u "cde" in ans |
|
|||
|
Thanks, i never new about that sub() thing, Anyone know how to combine strings?
|
|
|||
|
combining strings is easy as +
"???"+"???" will give you "??????" str1+str2 gives you string 1 with string 2 attached at the end str1+"???" gives you string with 3 ?s at the end |
|
|||
|
Sweet that makes my life a whole lot easier lol
|
|
|||
|
...no, str3=str1 + str2 does not combine string 1 and 2 into 3
what happens with this line is it tests str1+str2 and checks if it matches up to str3 ex: str1 is abc, str2 is def if str3 is abcdef, the line str3=str1+str2 will give you a 1 (true) if str3 does not equal abcdef, it will give you a 0 (false) if the = is just your representation of the store arrow im sorry |
|
|||
|
if you are writing a hangman program this command could also be useful:
instring(string,string to look for,(optional starting point) for example instring("abcdc","c" will give you 3 as "c" is the third letter in the first string you can alter it with an added command at the end like so instring("abcdc","c",4 so that it starts looking for "c" at the 4th letter the line above will return a 5 in ans |
|
|||
|
Quote:
I just learned how to use the TI's language correctly (as in today), and I think what really held me back was what you just described. I've worked with ActionScript and Blitz in the past, so learning that -> is = really threw me a curveball. |
|
|||
|
thanks this stuff really helps, im gonna take a break from ti programming tho, im trying to learn C++
![]() |
![]() |
| Viewing: Dev Hardware Forums > SOFTWARE > TI 83/84 > Strings to Chars |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|