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 -

Fatal error: Call to undefined function menu_execute_active_handler() in drupal 7.9 -

python - RuntimeWarning: PyOS_InputHook is not available for interactive use of PyGTK -