can you help me with input mask?
String format = “X-XX-XXX”
X is the user input from console / keyboard.
I keep wanting to show the dash (-) while the user input to the string format.
Can you help me to solve my problem?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s impossible to show the entire mask while typing, but what you can do is read individual chars in at a time and when you get to the relevant places, output a dash.
Edit: It may be possible to move the cursor in the console, that way you can output the mask and then manoeuvre the cursor accordingly (depending on how many keys have been pressed).
I just found this here:
Which should move the cursor to position 10,10 on the console.