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

Integrating OpenAI / ChatGPT in ASP.NET Core Web API

 This guide shows how to build a production-ready AI API using ASP.NET Core with: Clean Architecture, streaming responses, database storage,...