Computer Science Canada String Manipulation Problem |
Author: | highly [ Sat Nov 28, 2009 4:16 am ] | ||
Post subject: | String Manipulation Problem | ||
I'm trying to achieve an effect where the output is Highly HighlyHighly HighlyHighlyHighly HighlyHighlyHighlyHighly HighlyHighlyHighlyHighlyHighly HighlyHighlyHighlyHighly HighlyHighlyHighly HighlyHighly Highly HighlyHighly HighlyHighlyHighly HighlyHighlyHighlyHighly etc, and will repeat this pattern for as long as I determine My problem is that when I try to use -= when pertaining to a string, I get an error. there must be a way to remove text from the end of a string, but I do not know it, and it wasn't covered in the string manipulation tutorial. I'm not new to programming, just new to turing. I'm, using turing 4.1.1a here's my code,
the problem occurs around "n := -p ", and "n -= p" doens't work either. Both n and p are strings. any help is much appreciated |
Author: | Zren [ Sat Nov 28, 2009 5:45 am ] | ||
Post subject: | Re: String Manipulation Problem | ||
To clip the string you have to create a substring with the range of the beginning to X characters from the end.
What other languages do you know btw? |
Author: | highly [ Sat Nov 28, 2009 6:20 am ] | ||||
Post subject: | Re: String Manipulation Problem | ||||
Zren @ Sat Nov 28, 2009 5:45 am wrote: To clip the string you have to create a substring with the range of the beginning to X characters from the end.
What other languages do you know btw? Well, I'm most well-versed in AS2, and have dabbled in java, ahk, etc. Nothing besides as2 has really done anything for me lol besides that I've meddled in various application scripting languages (mIRC scripting language, lua briefly a loooong time ago for cortex command, etc) but have only recently gotten into it at any depth. But I love turing. I'd remembered reading about it in a book about the history of Artificial Intelligence, and recently ran into a game using it. Very fun language, if I do say so myself. EDIT: Finished the code, was rather simple, Thanks to you Zren ![]()
|
Author: | Zren [ Sat Nov 28, 2009 9:07 am ] | ||
Post subject: | Re: String Manipulation Problem | ||
You'll learn to hate and love Turing at the same time. It's simplity rubs off at the really annoying limitations sometimes. But you just can't get rid of it. Btw, since you finished it that way, I might as well point out a reall usefull function in Turing syntax. put "Dude".. put "What" Will output DudeWhat on the same line. So you don't need to modify a string. You could write it through a for loop. To be more specific, the "____".. at the end of a put statement will allow the next put to be placed on the same line.
|
Author: | Tony [ Sat Nov 28, 2009 2:38 pm ] | ||
Post subject: | Re: String Manipulation Problem | ||
and then you realize that Turing has a build in function repeat
This also reminds me of this magic |
Author: | highly [ Sat Nov 28, 2009 2:45 pm ] | ||
Post subject: | Re: String Manipulation Problem | ||
Tony @ Sat Nov 28, 2009 2:38 pm wrote: and then you realize that Turing has a build in function repeat
This also reminds me of this magic Lmao! Something tells me you're somewhat of a turing guru? |
: |