I am making a program to display a line of text. The calc will run a loop displaying a temp. message until a key is clicked. When a key is clicked, the letter associated to the button will be added to a string. The calc then displays the string and runs the loop again. I don't know how to work a string though. Can someone help me with stings?
Three main functions or operators are relevant to string manipulation:

:: The plus (+) operator: concatenate strings
:: The sub() command: pick out a substring of a string
:: The inString() command: get the numerical index of a substring in a string.

Can you be a bit more specific?
How can I fist create a string with "temp." as the message? Then how do I add things to strings?

Code:

:"temp->str1
:" foo bar->str2
:str1+str2->str3
:disp str3




the display will look like

temp foo bar
How does one get to the string command?
vars -> string (7)
You only need one quote for the text not two (e.g. "Temp" vs. "Temp)? How do I clear the string? How can I add a letter to the string? (e.g. I have temp in my string and I want to add the letter a to the end)
Correct, it is one of the optimizations that you can do in ti-basic.

Also, this might be of interest/help to you

http://tibasicdev.wikidot.com/sk:strings
Yes, if it doesn't affect order of operations, you don't need to balance quotes or parentheses. It's a small, oft overlooked feature of TI BASIC, but I've been able to shave 1-2kb off of a 14kb BASIC program just because of that.
JPfowl wrote:
How does one get to the string command?
The StrN are variable names, not commands, to be a bit pedantic. Smile
If you're using a TI-89, you can also do this:


Code:
"Test message" & key ->new_msg

disp new_msg
flib("slmsg:"&new_msg)
pause new_msg


Where key is the key you've pressed. The & operator concatenates 2 string variables. Choose the display command as you wish.

Cheers!
Charlie
CharlieMAC wrote:
If you're using a TI-89, you can also do this:


Code:
"Test message" & key ->new_msg

disp new_msg
flib("slmsg:"&new_msg)
pause new_msg


Where key is the key you've pressed. The & operator concatenates 2 string variables. Choose the display command as you wish.

Cheers!
Charlie


I don't have a 89 I have a 84.
Ok to add a letter to the end. This would work


Code:

"Temp->Str1
Str1+"BLAH->Str1

//This would take Str1 which contains Temp and add BLAH to it. //Which would display as: TempBLAH
http://www.ticalc.org/archives/files/fileinfo/363/36335.html

Check out these programs here, and ask any questions you have about them. Smile
You don't have a TI-84; there's no such calculator. You have a TI-84+. Smile
tifreak8x wrote:
http://www.ticalc.org/archives/files/fileinfo/363/36335.html

Check out these programs here, and ask any questions you have about them. Smile


Will do when I get done with school today. How do I delete/clear a string?
Go into PRGM in the editor, down near the bottom of the list is a command called DelVar, just use it and put what string variable you want deleted behind that.
Let's say I have some text and some integer (like an answer stored into x) and I want to join those so I can output them together. How could I do so? Is it possible with strings? (I want to join them to make it easier to output if I have multiple groups of text and integer).
check out these two commands:
Equ>String(
String>Equ(
what you want is Equ>String, in this case. store your value to Y1-Y0, and then use Equ>String(YN, StringN to store it into StringN.
then just concatenate the two strings like shown above =)

edit: oh, and Y1-Y0 can be accessed through Vars ->Y-Vars ->Function
All right, my turn.

In order to display text in a string and an integer at the same time, you must do one of two things:

*Use two different display commands.
*Or, if you intend on concatenating the integer with the string, you must convert the integer to a string. This routine will come in handy for that.

Does that answer your question?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement