Tuesday, August 27, 2013

remove extra space between two words using C#

RegexOptions options = RegexOptions.None;
Regex regex = new Regex(@"[ ]{2,}", options);     
tempo = regex.Replace(tempo, @" ");
 or even:
myString = Regex.Replace(myString, @"\s+", " "); 

No comments:

Post a Comment

📱Build WhatsApp Bot using .NET + OpenAI

   In this article, you will learn how to build a real-world WhatsApp chatbot using ASP.NET Core and OpenAI. This bot can automatically repl...