How do I limit the number of Input characters?

Blitz3D Forums/Blitz3D Beginners Area/How do I limit the number of Input characters?

Ace Killjoy(Posted 2009) [#1]
I have an Input line that needs to hold 4 or less charachers.
But I can't seem to limit the amount of charachers that I can input.

I thought the Len command would do the trick for me but it doesn't seem to do what I want.

Is there a way I can limit my input to 4 characters or less?


Zethrax(Posted 2009) [#2]
You can clip your string back to four characters by using the Left$ (string$, length) command ( http://www.blitzbasic.com/b3ddocs/command.php?name=Left&ref=2d_a-z ).

As far as I'm aware, there is no way to restrict the number of characters that the Input command will accept. If that's what you need, then you will probably need to write your own input function. You may also find something in the code archives to do what you want.

Also, I recommend that you browse through the documentation and tutorials to aquaint yourself with the various functions that are available. No need to learn them all by heart - just give yourself a rough overview.


InvisibleKid(Posted 2009) [#3]
is something like this what your looking for?




Ace Killjoy(Posted 2009) [#4]
YES! That will work.
Thank you very much.

I'm not used to working with this kind of text coding so I believe I'll be looking into those tutorials sooner or later.