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

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -