AdvantageCMS.Core.Common.BaseClasses Namespace
Build With Advantage

StringExtensions..::..UrlFriendly Method

Creates a string that is Url-friendly.

Namespace:  AdvantageCMS.Core.Common
Assembly:  AdvantageCMS.Core (in AdvantageCMS.Core.dll)

Syntax


public static string UrlFriendly(
	this string text,
	string separator,
	int maxLength
)

Parameters

text
Type: String
The text.
separator
Type: String
The separator.
maxLength
Type: Int32
The maximum length.

Return Value

System.String.

Examples


C#
string slug = "Hello World! This is a Test".UrlFriendly(); // returns "hello-world-this-is-a-test"
string custom = "Hello World".UrlFriendly("_"); // returns "hello_world"