Limiting Get Statements to a certain amount of letters
Author |
Message |
Joe Keller
|
Posted: Thu Jan 19, 2012 10:09 pm Post subject: Limiting Get Statements to a certain amount of letters |
|
|
What is the problem you are having?
Okay so my problem is that I am asking the user to enter his initials, and i want to limit it so that he cant enter more than 2 letters, because i have a background space in which only that many letters can fit in, so if i enter J.K. it'll fit, but Joe K wont so when i say: get username, how do i limit it so that the user cant enter more than two letters.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Turing: |
<Add your code here>
get username <--- %when i draw it down there the name can go on really long, i want to limit it so that it can only be like 2 or 3 letters, so some idiot doesnt enter Joe K thinking thats his initials
var font4 : int
font4 := Font.New ("Arial:20")
Font.Draw (username, 65, 115, font4, 7)
|
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
crossley7
|
Posted: Thu Jan 19, 2012 10:21 pm Post subject: RE:Limiting Get Statements to a certain amount of letters |
|
|
try to have something like this
Turing: |
var initials : string (2) % The 2 means the size of the string is only 2 characters.
get initials
|
You could also read in as characters, etc. A few different ways around the problem |
|
|
|
|
 |
Alex C.
|
Posted: Thu Jan 19, 2012 10:21 pm Post subject: RE:Limiting Get Statements to a certain amount of letters |
|
|
well put the get statement in a loop, then an if statement that checks "if length (username) >= 2 then blah-blah elsif length (username)= 2 exit loop
something like that... Look up the proper syntax!
EDIT: ...damn i got beat |
|
|
|
|
 |
Joe Keller
|
Posted: Thu Jan 19, 2012 10:24 pm Post subject: RE:Limiting Get Statements to a certain amount of letters |
|
|
Thanks Alot Guys, I really appreciate it, and Both of you were an incredible help! |
|
|
|
|
 |
Tony

|
Posted: Thu Jan 19, 2012 10:25 pm Post subject: RE:Limiting Get Statements to a certain amount of letters |
|
|
you can try reading the documentation for get -- it talks about just this. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
|
|