How to fix alpha- numeric sequence | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to fix alpha- numeric sequence

I make program in this i want enter bank cheque no. So 123a56jk 123a56jq So first three digit fix to entry decimal no. And after one character then 2 decimals and... So how to fix and what should I use for this like structure, union, array.....??? But I Compulsury store in sequence if anyone try to wrong entry then program give not valid

3rd Oct 2019, 8:08 PM
Vishwas Kaushal
Vishwas Kaushal - avatar
3 Answers
0
Are you trying to check if a user input cheque number in the correct format? If so, look up regular expression. I've used regex in python and I know it's available in C++, I've just not used it in that language sorry. or Use isalpha() and isdigit() as appropriate on individual elements of the string.
3rd Oct 2019, 9:37 PM
rodwynnejones
rodwynnejones - avatar
0
Hey. I'd say this strongly depends on what you are planning on doing with the data. If you need to display them only, store it to a string. If you are to carry out user defined operations (comparison, validation, etc) implement a separate class providing these operation. Hope this helps. Cheers. C
3rd Oct 2019, 8:46 PM
ChrA
ChrA - avatar
0
Tnkew.. But I Compulsury store in sequence if anyone try to wrong entry then program give not valid
3rd Oct 2019, 9:16 PM
Vishwas Kaushal
Vishwas Kaushal - avatar