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

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -