Table of Contents

Class StringUtils

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

Contains string related static methods.

public static class StringUtils
Inheritance
StringUtils

Fields

BoldTagEnd

Gets html end bold tag string constant.

BoldTagStart

Gets html start bold tag string constant.

BracketsChars

Gets brackets characters used in TrimWhitespaceAndBrackets(string?) and some other places.

FourSpaces

Gets initialized string with four space characters.

MacCommandKeyTitle

Gets title of the command key on MacOs (0x2318 character).

OneCarriageReturn

Gets initialized string with one carriage return.

OneDoubleQuote

Gets initialized string with one double quote character (").

OneNewLine

Gets initialized string with one new line character.

OneSpace

Gets initialized string with one space character.

StringSplitToArrayChars

Gets or sets values that split one string to many.

ThreeDots

Gets initialized string with three dots.

TryParseNumberDelegates

Gets or sets array of delegates used for the text to number conversion.

Properties

ComparerObjectUsingToString

Returns IComparer<T> which converts objects to strings using ToString() and uses Compare(string, string, StringComparison) for comparing.

Methods

EqualsNewLine(string)

Gets whether the specified string equals CR, LF or their combinations.

GetTrimTextRulesChars(TrimTextRules)

Gets an array of characters that can be passed to Trim(params char[]) function from the specified TrimTextRules parameter.

GetUniqueString()

Generates unique string in the format A00000000000000000000000000000000 where 0 represents a digit.

HasOnlyValidChars(string?, Func<char, bool>)

Gets whether the specified string has only valid chars.

InsertBoldTags(string, string, StringComparison)

Inserts html bold tags before and after substring.

InsertTags(string, string, string, string, StringComparison)

Inserts tags before and after substring.

IsEnglishCharOrDot(char)

Gets whether the specified character is english char or dot.

IsHexNumber(string?)

Gets whether text is a hex number.

LimitLength(string?, int)

Limits the length of text to a defined length.

OverrideIgnoreCase(StringComparison, bool)

Changes StringComparison value to use ignoreCase.

ParseTextWithIndexAccel(string, int, FontStyle)

Splits text into three parts using the specified position of the accelerator character. Returns an array of three TextAndFontStyle elements.

ParseWithTypeConverter(string?, TypeConverter?, ITypeDescriptorContext?, CultureInfo?, bool)

Parses the string representation of an object using the specified type converter.

ParseWithTypeConverter<T>(string?, ITypeDescriptorContext?, CultureInfo?, bool)

Parses the string representation of an object using TypeConverter registered for the T type.

PrefixSuffix(string, string)

Modfies specified string by adding prefix and suffix.

SafeStringFormat(string?, string?)

Calls Format(string, object) in a safe way allowing to use null parameters.

SafeTrim(string?, TrimTextRules)

Trims the string using the specified text trimming rules. Result is always not Null.

Split(string, bool)

Splits one string to many using StringSplitToArrayChars as separators.

StartsWith<T>(string, IEnumerable<T>)

Gets whether string s starts with one of the strings specified in items collection.

ToStringSimple<T>(IEnumerable<T>)

Combines array elements to string without any separators.

ToStringWithOrWithoutNames<T>(string[], T[])

Combines name and value pairs to string. If UseNamesInToString is false, names are ignored and only values are returned.

ToString<T>(IEnumerable<T>, string?, string?, string?)

Combines array elements to string inside prefix and suffix. Array elements are separated by the string specified in the separator parameter.

ToString<T>(string[]?, T[])

Combines name and value pairs to string.

Trim(string?, TrimTextRules)

Trims the string using the specified text trimming rules.

Trim(string?, bool, bool)

Removes all leading and trailing white-space characters from the string. trimStart and trimEnd parameters specify whether to remove leading and trailing occurrences.

Trim(string?, char[], bool, bool)

Removes all leading and trailing occurrences of a set of characters specified in an array from the string. trimStart and trimEnd parameters specify whether to remove leading and trailing occurrences.

TrimWhitespaceAndBrackets(string?)

Removes all leading and trailing brackets and white-space characters from the specified string. Uses bracket characters from BracketsChars.

TryParseByte(string?, NumberStyles, IFormatProvider?, out object?)

Calls TryParse(string, NumberStyles, IFormatProvider, out byte)

TryParseDecimal(string?, NumberStyles, IFormatProvider?, out object?)

Calls TryParse(string, NumberStyles, IFormatProvider, out decimal)

TryParseDouble(string?, NumberStyles, IFormatProvider?, out object?)

Calls TryParse(string, NumberStyles, IFormatProvider, out double)

TryParseInt16(string?, NumberStyles, IFormatProvider?, out object?)

Calls TryParse(string, NumberStyles, IFormatProvider, out short)

TryParseInt32(string?, NumberStyles, IFormatProvider?, out object?)

Calls TryParse(string, NumberStyles, IFormatProvider, out int)

TryParseInt64(string?, NumberStyles, IFormatProvider?, out object?)

Calls TryParse(string, NumberStyles, IFormatProvider, out long)

TryParseNumber(TypeCode, string?, NumberStyles?, IFormatProvider?, out object?)

Converts the string representation of a number to its number equivalent. A return value indicates whether the conversion succeeded or failed.

TryParseNumberWithDelegates(string?, NumberStyles, IFormatProvider?, out object?, IEnumerable<TryParseNumberDelegate>)

Uses collection of TryParseNumberDelegate delegates in order to convert string to a number.

TryParseSByte(string?, NumberStyles, IFormatProvider?, out object?)

Calls TryParse(string, NumberStyles, IFormatProvider, out sbyte)

TryParseSingle(string?, NumberStyles, IFormatProvider?, out object?)

Calls TryParse(string, NumberStyles, IFormatProvider, out float)

TryParseUInt16(string?, NumberStyles, IFormatProvider?, out object?)

Calls TryParse(string, NumberStyles, IFormatProvider, out ushort)

TryParseUInt32(string?, NumberStyles, IFormatProvider?, out object?)

Calls TryParse(string, NumberStyles, IFormatProvider, out uint)

TryParseUInt64(string?, NumberStyles, IFormatProvider?, out object?)

Calls TryParse(string, NumberStyles, IFormatProvider, out ulong)