Slugifier Class
Namespace: PTS.Text
Assembly: PTS.Text.dll
Provides static methods for string that produce slugged tokens for urls.
Syntax
public static class Slugifier
Inheritance
Methods
IsSlugified(String)
Checks whether the string is in valid slugified format.
Declaration
public static bool IsSlugified(this string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string the validate. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsSlugifiedId(String)
Checks whether the string is in valid slugified Id format
Declaration
public static bool IsSlugifiedId(this string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string to validate. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Slugify(String)
Transliterates the string into ascii and removes all url incompatible characters.
Declaration
public static string Slugify(this string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string to get slugified version of. |
Returns
| Type | Description |
|---|---|
| System.String | Slugified version of the original string. |
SlugifyId<TId>(String, TId)
Transliterates the string into ascii and removes all url incompatible characters, appends specified id at the end.
Declaration
public static string SlugifyId<TId>(this string value, TId id)
where TId : IConvertible
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string to get slugified version of. |
| TId | id | The id that will be appended to the end of the slug. |
Returns
| Type | Description |
|---|---|
| System.String | Slugified version of the original string with an id at the end. |
Type Parameters
| Name | Description |
|---|---|
| TId | Type of an id that will be appended to the slug. |
UnSlugifyId(String)
Extracts id value out of slugified string.
Declaration
public static string UnSlugifyId(this string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string the get an id from. |
Returns
| Type | Description |
|---|---|
| System.String | Returns an id in slugified string if present, otherwise |