Monday, March 26, 2012

Formatting values being passed to Sql

I have a generic page with some fields on it, I would like to be able to "groom" the values so that the data is nice and consistent.

Example: input 1 -- user types in "bob" or "BOB" or "Bob" or "JOE" etc...

the resulting record in Sql would be "Bob", "Fred", "Joe"
nice and formted out.

Any suggestions?string str1, str2 , formattedname
str1 = (name.ToUpper()).SubString(0,1)
str2 = (name.ToLower()).SubString(1)

formattedname = String.concat(str1,str2)

wher name is the string that contains the name to format. hope this helps

No comments:

Post a Comment