Url Encode Spaces - CSharp System

CSharp examples for System:String Encode Decode

Description

Url Encode Spaces

Demo Code

//     Copyright (c) Microsoft Corporation.  All rights reserved.
using System.Text;
using System;//from   ww  w .  j  a  v  a 2 s.  c o m

public class Main{
        //  Helper to encode spaces only
		internal static String UrlEncodeSpaces( string str ) {
			if( str != null && str.IndexOf( ' ' ) >= 0 )
				str = str.Replace( " ", "%20" );
			return str;
		}
}

Related Tutorials