Computer Science Canada strings help |
Author: | Cheburashka [ Thu May 07, 2009 6:25 pm ] |
Post subject: | strings help |
i need to find a way to flip the variable so for example if the person enters a word lets say "myname" i need it to convert to "emanym", so i can work with it later. if anyone knows a possible code to do that please help or you know how you can get to display variables letters such as name(1..3) how is it possible to make it (3..1)?????????? |
Author: | Tony [ Thu May 07, 2009 6:54 pm ] |
Post subject: | RE:strings help |
well you can start with name(1), name(2), name(3), and then place them in the correct order. |
Author: | Cheburashka [ Thu May 07, 2009 7:00 pm ] |
Post subject: | Re: strings help |
i get what you mean i tried it before, but my teacher said there is a way to simplify it, so i think its either reverse the name and mak i go (1..3),, or somehow chafigure out the (3..1) way |
Author: | andrew. [ Thu May 07, 2009 7:10 pm ] |
Post subject: | RE:strings help |
Try using for loops to go through each letter forwards and then backwards with another for loop. |
Author: | Dusk Eagle [ Thu May 07, 2009 7:38 pm ] |
Post subject: | Re: strings help |
I don't see why you need to go forward through the loop at all. Do you know how to go backward through a for loop? If so this task should be pretty simple. (If you don't, look in the Turing documentation of 'for' loops). |
Author: | Cheburashka [ Thu May 07, 2009 7:44 pm ] |
Post subject: | Re: strings help |
Dusk Eagle @ Thu May 07, 2009 7:38 pm wrote: I don't see why you need to go forward through the loop at all. Do you know how to go backward through a for loop? If so this task should be pretty simple. (If you don't, look in the Turing documentation of 'for' loops).
yeah its for decreasing what i've tried is for decreasing x : len .. 1 put name (x) end for it works but its in the upward direction like a m a n when i press locate it only gives me the first letter of the name if possible can you please tell me what i need to fix about it |
Author: | Cheburashka [ Thu May 07, 2009 7:47 pm ] |
Post subject: | Re: strings help |
Dusk Eagle @ Thu May 07, 2009 7:38 pm wrote: I don't see why you need to go forward through the loop at all. Do you know how to go backward through a for loop? If so this task should be pretty simple. (If you don't, look in the Turing documentation of 'for' loops).
actally nvm i think i already got it thanks for help though |
Author: | Kharybdis [ Thu May 07, 2009 7:55 pm ] | ||
Post subject: | Re: strings help | ||
Cheburashka @ Thu May 07, 2009 7:44 pm wrote: Dusk Eagle @ Thu May 07, 2009 7:38 pm wrote: I don't see why you need to go forward through the loop at all. Do you know how to go backward through a for loop? If so this task should be pretty simple. (If you don't, look in the Turing documentation of 'for' loops).
yeah its for decreasing what i've tried is for decreasing x : len .. 1 put name (x) end for it works but its in the upward direction like a m a n when i press locate it only gives me the first letter of the name if possible can you please tell me what i need to fix about it
|