Computer Science Canada can you delete a part of a string? |
Author: | junkpro11 [ Sat May 29, 2004 8:48 pm ] | ||
Post subject: | can you delete a part of a string? | ||
i want to getch sth then add all the strings together, and if the backspace is pressed, i want to delete watever i recently getch this is my code
|
Author: | Paul [ Sat May 29, 2004 8:53 pm ] | ||||
Post subject: | |||||
its like this, you have a string say
then if backspace is pressed, then make the word = to this
|
Author: | junkpro11 [ Sat May 29, 2004 9:04 pm ] |
Post subject: | |
thanks! |
Author: | Paul [ Sat May 29, 2004 9:07 pm ] |
Post subject: | |
lets say u have a string containing "abcde" the first letter of the string, or in the code word(1) is a word(2) is b and so on. The code, when u press backspace it makes the value of the word equal to from the first letter of ur string to the second last letter so if you have abcde the code would reduce it to abcd, when u press backspace ofcourse it would crash when you have nothing left and u still press backspace... so u have to restrict that. length(word) just finds the length and word:=word(1..(length(word)-1)) is basically, word is equal to word from letter one to the second last letter. |
Author: | junkpro11 [ Sat May 29, 2004 9:35 pm ] |
Post subject: | |
thanks....i experimented a bit and kinda understood the code. u cleared things up though.. thanks! |