New to Telerik UI for BlazorStart a free 30-day trial

Extension methods for working with strings

Definition

Namespace:Telerik.DataSource.Extensions

Assembly:Telerik.DataSource.dll

Syntax:

C#
public static class StringExtensions

Inheritance: objectStringExtensions

Methods

Returns the string In Title Case Formatting

C#
public static string AsTitle(this string value)
Parameters:valuestringReturns:

string

C#
public static string EscapeHtmlEntities(this string html)
Parameters:htmlstringReturns:

string

Replaces the format item in a specified System.String with the text equivalent of the value of a corresponding System.Object instance in a specified array.

C#
public static string FormatWith(this string instance, params object[] args)
Parameters:instancestring

A string to format.

argsobject[]

An System.Object array containing zero or more objects to format.

Returns:

string

A copy of format in which the format items have been replaced by the System.String equivalent of the corresponding instances of System.Object in args.

C#
public static bool HasValue(this string value)
Parameters:valuestringReturns:

bool

Determines whether this instance and another specified System.String object have the same value.

C#
public static bool IsCaseInsensitiveEqual(this string instance, string comparing)
Parameters:instancestring

The string to check equality.

comparingstring

The comparing with string.

Returns:

bool

true if the value of the comparing parameter is the same as this string; otherwise, false.

Determines whether this instance and another specified System.String object have the same value.

C#
public static bool IsCaseSensitiveEqual(this string instance, string comparing)
Parameters:instancestring

The string to check equality.

comparingstring

The comparing with string.

Returns:

bool

true if the value of the comparing parameter is the same as this string; otherwise, false.

Escapes a string for JavaScript by wrapping it in " symbols if true is passed, otherwise returns the original string.

C#
public static string JavaScriptStringEncode(this string value, bool addDoubleQuotes)
Parameters:valuestringaddDoubleQuotesboolReturns:

string

Escapes a string for use in JavaScript

C#
public static string JavaScriptStringEncode(this string value)
Parameters:valuestringReturns:

string

Splits a string to space-separated words in Pascal Case

C#
public static string SplitPascalCase(this string value)
Parameters:valuestringReturns:

string

Returns the string in camelCase casing

C#
public static string ToCamelCase(this string instance)
Parameters:instancestringReturns:

string

Returns the enum member the string parses to

C#
public static T ToEnum<T>(this string value, T defaultValue)
Parameters:valuestringdefaultValueTReturns:

T