Trim Verbatim String - CSharp System

CSharp examples for System:String Strip

Description

Trim Verbatim String

Demo Code


using System.Text.RegularExpressions;
using System.Linq;
using System;//from  w ww  .j a v  a2 s  .  c om

public class Main{
        public static string TrimVerbatim(this string s)
        {
            var r = new Regex(@"^\s+", RegexOptions.Multiline);
            return r.Replace(s, string.Empty);
        }
}

Related Tutorials