![]() |
coding help - Printable Version +- Jiggmin's Village (https://jiggmin2.com/forums) +-- Forum: Village Central (https://jiggmin2.com/forums/forumdisplay.php?fid=4) +--- Forum: Blogs (https://jiggmin2.com/forums/forumdisplay.php?fid=44) +--- Thread: coding help (/showthread.php?tid=2484) |
coding help - JEEJAYEM - 28th April 2020 http://prntscr.com/s7l0rf got a problem with lines 31-36 its supposed to catch the exception if there is a non-number character in the string but it doesnt catch it if its the last 3 characters i.e "123-45-7abc" is apparently a valid SSN format according to my code (but its not supposed to be) RE: coding help - bls1999 - 28th April 2020 charAt equates to an integer (ASCII codes). See here for more information: https://www.cs.cmu.edu/~pattis/15-1XX/common/handouts/ascii.html. Therefore, parseInt() won't throw an error. If you want to test if it's not a number, try this: Code: char thisChar = ssn.charAt(i); |