Parse and convert mobile phone to format like +77015543456 - CSharp System

CSharp examples for System:String Convert

Description

Parse and convert mobile phone to format like +77015543456

Demo Code


using System.Text.RegularExpressions;

public class Main{
        /// <summary>
		/// Parse and convert mobile phone to format like +77015543456
		/// </summary>
		/// <param name="phone">Mobile phone source string</param>
		/// <returns></returns>
		public static string ParseMobilePhone(string phone)
		{/*ww w.j  a v  a2 s  .  c  o m*/
			return Regex.Replace(phone, @"[^+0-9]", "");
		}
}

Related Tutorials