c# - Remove extra white spaces on string with special characters -


i having trouble removing white spaces following:

abc\ae.exe        1 b 2%%  acu > log.txt 

i using following code remove spaces (that found on s.o.):

regex.replace(cmdline, @"^\s*$\n", string.empty, regexoptions.multiline).trimend(); 

the above code removing white spaces between abc\ae.exe & fine; however, not removing white space 2%% acu (has 2 spaces in between).

i not familiar reg expressions assuming has fact % sign might reg ex key word.

any guidance appreciated.

regex.replace(cmdline,@"\s+"," "); 

will replace multiple spaces single space

the + means match character 1 or more times

here's regex guide c#


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -