Class StringExtensions
Contains extension methods for string manipulation.
Inherited Members
Namespace: DataWeb.Text
Assembly: DataWeb.Core.dll
Syntax
public static class StringExtensions
Methods
FromUrlBase64(string)
Decodes a URL-safe Base64 string.
Declaration
public static string FromUrlBase64(this string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The URL-safe Base64 string to decode. |
Returns
| Type | Description |
|---|---|
| string | The decoded string. |
Limit(string, int, string)
Limits the length of a string and appends a suspension string if it exceeds the specified length.
Declaration
public static string Limit(this string text, int length, string suspension = "...")
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The string to limit. |
| int | length | The maximum length of the string. |
| string | suspension | The string to append if the string is limited. |
Returns
| Type | Description |
|---|---|
| string | The limited string. |
Slugify(string)
Converts a string to a slug, replacing invalid characters with hyphens.
Declaration
public static string Slugify(this string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The string to convert to a slug. |
Returns
| Type | Description |
|---|---|
| string | The slugified string. |
ToCamelCase(string)
Converts the first character of a string to lowercase.
Declaration
public static string ToCamelCase(this string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The string to convert. |
Returns
| Type | Description |
|---|---|
| string | The converted string. |
ToPascalCase(string)
Converts the first character of a string to uppercase.
Declaration
public static string ToPascalCase(this string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The string to convert. |
Returns
| Type | Description |
|---|---|
| string | The converted string. |
ToUrlBase64(string)
Encodes a string as URL-safe Base64.
Declaration
public static string ToUrlBase64(this string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The string to encode. |
Returns
| Type | Description |
|---|---|
| string | The URL-safe Base64 encoded string. |