Shortening my string

Blitz3D Forums/Blitz3D Beginners Area/Shortening my string

Kiyoshi(Posted 2011) [#1]
So there I was, playing around with Blitz3D once again, making fun little pieces of code to keep boredom at bay. However, I realized that I didn't know how to do what I wanted to do. Alas, I turned to the masters for help!

Here's my problem.

I have created a string: "Hello world"
I want to be able to erase the last letter of the string when I press backspace.
Backspace press= "Hello worl"
Another backspace press= "Hello wor"

But I don't know how to do that^^

Please help, O great ones!


Yasha(Posted 2011) [#2]
str = Left(str, Len(str) - 1)


?


Kryzon(Posted 2011) [#3]
You are very much capable of figuring this out; it's a matter of logic.

A backspace removes a character from the end of the string. How do you retrieve a string that is the current string without the last character?

value$ = "Hello World"

Mid(value, 1, Len(value)-1)



Kiyoshi(Posted 2011) [#4]
Ah, thank you. See, I've hardly ever worked with strings, so the commands are a little foreign to me. I do apologize if this question was a little too stupid for the forums. o_o

I will strive to be less incompetent in the future!


Kryzon(Posted 2011) [#5]
Many times you just can't think outside the box or see the solution which is partially there, but out of your reach. So a second opinion is necessary.

With that in mind, there is no such thing as a stupid question :)