私はテキストを持っています:
SMS \r\n\t• Map - locations of
•と次の最初の文字の間の空白をすべて削除するにはどうすればよいですか?
上記の例では、次のようになります。
SMS \r\n\t•Map - locations of
私はテキストを持っています:
SMS \r\n\t• Map - locations of
•と次の最初の文字の間の空白をすべて削除するにはどうすればよいですか?
上記の例では、次のようになります。
SMS \r\n\t•Map - locations of
正規表現を使用すると、次のように実行できます。
var input = "SMS \r\n\t• Map - locations of";
var regexPattern = @"(?<=•)\s+(?=\w)";
var cleanedInput = Regex.Replace(input, regexPattern, String.Empty);
これにより、•と最初の単語文字の間の空白が空の文字列に置き換えられます。
string s = "SMS \r\n\t• Map - locations of";
string[] temp = s.Split('•');
s = temp[0]+temp[1].TrimStart(' ');
この正規表現を使用できます:
string toInsertBetween = string.Empty;
string toReplace = "SMS \r\n\t• Map - locations of";
string res = Regex.Replace(toReplace, "•[ ]+([^ ])", "•" + toInsertBetween + "$1");