c# - Convert fullwidth to halfwidth -
in c#, how convert string that's using fullwidth form characters halfwidth form characters?
for example, given userinput
below, want convert Stackoverflow
stackoverflow
:
string userinput= "Stackoverflow"; //string userinput= "stackoverflow";
you can use string.normalize()
method:
string userinput = "Stackoverflow"; string result = userinput.normalize(normalizationform.formkc); //result = "stackoverflow"
see example on dotnetfiddle.
more information on normalization forms can found on unicode.org.
Comments
Post a Comment