Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Example "1 2 3 4 5" would be : "1 2 3 4 5"?
- RegexOptions options = RegexOptions.None;
- Regex regex = new Regex(@"[ ]{2,}", options);
- tempo = regex.Replace(tempo, @" ");
- myString = Regex.Replace(myString, @"s+", " ");
- string xyz = "1 2 3 4 5";
- xyz = string.Join( " ", xyz.Split( new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries ));
- while(str.Contains(" ")) str = str.Replace(" ", " ");
- myString = Regex.Replace(myString, " {2,}", " ");
- myString = Regex.Replace(myString, @"s+", " ", RegexOptions.Multiline);
- string s = Regex.Replace (
- " 1 2 4 5",
- @"[ ]{2,}",
- " "
- );
- static class StringExtensions
- {
- public static string Join(this IList<string> value, string separator)
- {
- return string.Join(separator, value.ToArray());
- }
- }
- //...
- string s = " 1 2 4 5".Split (
- " ".ToCharArray(),
- StringSplitOptions.RemoveEmptyEntries
- ).Join (" ");
- public static string Join<T>(this IEnumerable<T> source, string separator)
- {
- return string.Join(separator, source.Select(e => e.ToString()).ToArray());
- }
- //...
- string s = " 1 2 4 5".Split (
- " ".ToCharArray(),
- StringSplitOptions.RemoveEmptyEntries
- ).Join (" ");
- while (str.IndexOf(" ") != -1)
- str = str.Replace(" ", " ");
Add Comment
Please, Sign In to add comment