CSharp examples for System:String Strip
Trims the string or returns null string if the value is empty
// Copyright (c) 2012 Computer Technology Solutions, Inc. ALL RIGHTS RESERVED using System.Text.RegularExpressions; using System.Text; using System.Linq; using System.Globalization; using System.Collections.Generic; using System;/*from ww w .ja va 2 s. c o m*/ public class Main{ /// <summary> /// Trims the string or returns null string if the value is empty /// </summary> /// <param name="value"></param> /// <returns></returns> public static string TrimOrNull(this string value) { return string.IsNullOrWhiteSpace(value) ? default(string) : value.Trim(); } }