Camillia
asked on
Format SSN
Not sure how to do this:
In the database, there's a table that holds the SSN format. For example, client1 might want their SSNs to look like 999-99-9999. Client2 might want their SSN to look like 999/99/9999. Client3 might want their SSN to look like 99-999-9999.
*** So the separater and the # of digits to the side of the separators might change.
The SSNs are stored as 999999999 in the database. Before displaying them in the gridview, I need to format them based on what the client wants them displayed...
SO I read 111228888, format, for example is 99-999-9999...then what? I think i need a class/routine to maybe read the format from the database, maybe parse the 9's before and after the separator, maybe count the digits and then parse the actual SSN like that?? any ideas?
In the database, there's a table that holds the SSN format. For example, client1 might want their SSNs to look like 999-99-9999. Client2 might want their SSN to look like 999/99/9999. Client3 might want their SSN to look like 99-999-9999.
*** So the separater and the # of digits to the side of the separators might change.
The SSNs are stored as 999999999 in the database. Before displaying them in the gridview, I need to format them based on what the client wants them displayed...
SO I read 111228888, format, for example is 99-999-9999...then what? I think i need a class/routine to maybe read the format from the database, maybe parse the 9's before and after the separator, maybe count the digits and then parse the actual SSN like that?? any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes. Of course, in your actual code you won't be using constants. It will probably be more like
YourDataReader("columnName ").ToStrin g(formatYo uLoadedFor User)
YourDataReader("columnName
ASKER
thanks.
ASKER
Like this: 999/99/9999 : 111223333.ToString("999/99
?