I have a line like "First Last Name" I want to replace empty spaces with%, for example
"First Last Name"
"First%Last%Name"
How to replace consecutive spaces with one%?
You can do this with a regex:
str = Regex.Replace(str, " +", "%");
var result = string.Join("%", str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));
Source: https://habr.com/ru/post/1333892/More articles:What languages ββprovide the use of object literals? - programming-languages ββ| fooobar.comShould interface methods throw exceptions? - javaUIView TransitionFromView example? - iphonehttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1333890/is-it-possible-to-serialize-custom-objects-to-a-plist-file-in-objective-c&usg=ALkJrhjw7xlc1s5cpGCuuQfEpARXmm-gwg"delete from table" does not delete the table? - c ++Seed spread - ruby-on-railsto create an excel file in .net without installed office - .netDrop-down menus appearing behind flash video - flashmulti-line terminal status indicator? - phpAspx radiobutton checklist in one line - asp.netAll Articles