0

Hi,

i am trying to write an application that uses validation check for social security number. it should allow 9 charachters. the first two and the last character should be leters and the rest should be digits.

i have used for loop but it doesnt work properly.

int noChar = 0;
for (i=0;i<8;i++)
{
char ch=aString.charAt(i)
if (noChar.isLetter(ch)==0||noChar.isLetter(ch)==1||noChar.isLetter(ch)==8){
return true;
}
else return false;
}
}

4
Contributors
5
Replies
7
Views
10 Years
Discussion Span
Last Post by DavidRyan
0

Tell me What exactly you rae trying to do.

Are you trying to mAtch the value from Database

Or you are matching the SSN with a dummy value taken in the Program itself

Can you provide more information or source code

0

He said exactly what he is trying to do.
He is trying to check that the input string starts with 2 letters, then has 6 digits, then another letter.

0

Which no doubt isn't enough and might not even be accurate...

At most it tells you whether the string could represent a US SSN, not whether it actually does.
And if there are more restrictions on how an SSN is constructed it may not do even that.

0

it should allow 9 charachters. the first two and the last character should be leters and the rest should be digits.

At most it tells you whether the string could represent a US SSN

Which is exactly what he asked for. If he wants it to actually check if the string is an American Social Security number, that would require a lot more work.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.