Link to home
Start Free TrialLog in
Avatar of kwh3856
kwh3856Flag for United States of America

asked on

How do you pluck a character from a string value in C#?

I am trying to manipulate a string value called Zip.  I want to be able to pull any digit of the zip and perform a caculation on it.  For example.  If the Zip had a value of 55522 and I wanted to add 8 to the third digit what what be the command to pull this digit out of the string.  I know it can be done with the string command in vb but I do not know the syntax in c#.

Any help is greatly appreciated.
Avatar of silemone
silemone
Flag of United States of America image

you could just use regular expression to substitute or substring...I will give examples...
but since string class is immutable, the best way to do this would be to use the stringbuilder class...
ASKER CERTIFIED SOLUTION
Avatar of silemone
silemone
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
just in case,

The StringBuilder library is at System.Text.StringBuilder...
Avatar of kwh3856

ASKER

Thank you very much!!