Show / Hide Table of Contents

    Class StringUtility

    This utility class is designed to make System.String operations easier to work with.

    Inheritance
    System.Object
    StringUtility
    Namespace: Cuemon
    Assembly: Cuemon.Core.dll
    Syntax
    public static class StringUtility

    Fields

    | Improve this Doc

    AlphanumericCharactersCaseSensitive

    A case sensitive representation of an alphanumeric character set consisting of the numbers 0 to 9 and the letters Aa to Zz.

    Declaration
    public const string AlphanumericCharactersCaseSensitive = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789"
    Field Value
    Type Description
    System.String
    | Improve this Doc

    AlphanumericCharactersSingleCase

    A single case representation of an alphanumeric character set consisting of the numbers 0 to 9 and the letters A to Z.

    Declaration
    public const string AlphanumericCharactersSingleCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    Field Value
    Type Description
    System.String
    | Improve this Doc

    CarriageReturn

    Carriage-return character.

    Declaration
    public const string CarriageReturn = "\r"
    Field Value
    Type Description
    System.String
    | Improve this Doc

    EnglishAlphabetCharactersMajuscule

    An uppercase representation of the English alphabet character set consisting of the letters A to Z.

    Declaration
    public static readonly string EnglishAlphabetCharactersMajuscule
    Field Value
    Type Description
    System.String
    | Improve this Doc

    EnglishAlphabetCharactersMinuscule

    A lowercase representation of the English alphabet character set consisting of the letters a to z.

    Declaration
    public static readonly string EnglishAlphabetCharactersMinuscule
    Field Value
    Type Description
    System.String
    | Improve this Doc

    HexadecimalCharacters

    A representation of a hexadecimal character set consisting of the numbers 0 to 9 and the letters A to F.

    Declaration
    public static readonly string HexadecimalCharacters
    Field Value
    Type Description
    System.String
    | Improve this Doc

    Linefeed

    Linefeed character.

    Declaration
    public const string Linefeed = "\n"
    Field Value
    Type Description
    System.String
    | Improve this Doc

    NetworkPathReference

    A network-path reference, eg. two forward slashes (//).

    Declaration
    public const string NetworkPathReference = "//"
    Field Value
    Type Description
    System.String
    | Improve this Doc

    NewLine

    Carriage-return/linefeed character combination.

    Declaration
    public const string NewLine = "\r\n"
    Field Value
    Type Description
    System.String
    | Improve this Doc

    NumericCharacters

    A representation of a numeric character set consisting of the numbers 0 to 9.

    Declaration
    public const string NumericCharacters = "0123456789"
    Field Value
    Type Description
    System.String
    | Improve this Doc

    PunctuationMarks

    A representation of the most common punctuation marks that conforms to the ASCII printable characters.

    Declaration
    public static readonly string PunctuationMarks
    Field Value
    Type Description
    System.String
    | Improve this Doc

    Tab

    Tab character.

    Declaration
    public const string Tab = "\t"
    Field Value
    Type Description
    System.String
    | Improve this Doc

    WhiteSpaceCharacters

    A representation of the most common whitespace characters.

    Declaration
    public static readonly string WhiteSpaceCharacters
    Field Value
    Type Description
    System.String

    Methods

    | Improve this Doc

    Chunk(String)

    Returns a sequence that is chunked into string-slices having a length of 1024 that is equivalent to value.

    Declaration
    public static IEnumerable<string> Chunk(string value)
    Parameters
    Type Name Description
    System.String value

    A System.String to chunk into a sequence of smaller string-slices for partitioned storage or similar.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.String>

    A sequence that is chunked into string-slices having a length of 1024 that is equivalent to value.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null.

    | Improve this Doc

    Chunk(String, Int32)

    Returns a sequence that is chunked into string-slices of the specified length that is equivalent to value. Default is 1024.

    Declaration
    public static IEnumerable<string> Chunk(string value, int length)
    Parameters
    Type Name Description
    System.String value

    A System.String to chunk into a sequence of smaller string-slices for partitioned storage or similar.

    System.Int32 length

    The desired length of each string-slice in the sequence.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.String>

    A sequence that is chunked into string-slices of the specified length that is equivalent to value.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null.

    System.ArgumentOutOfRangeException

    length is less or equal to 0.

    | Improve this Doc

    Contains(String, Char)

    Returns a value indicating whether the specified value occurs within the source.

    Declaration
    public static bool Contains(string source, char value)
    Parameters
    Type Name Description
    System.String source

    The System.String to seek.

    System.Char value

    The System.Char to search within source.

    Returns
    Type Description
    System.Boolean

    true if the value parameter occurs within the source, or if value is the empty string (""); otherwise, false.

    Remarks

    This method performs an ordinal (case-insensitive and culture-insensitive) comparison. The search begins at the first character position of this string and continues through the last character position.

    | Improve this Doc

    Contains(String, Char, StringComparison)

    Returns a value indicating whether the specified value occurs within the source.

    Declaration
    public static bool Contains(string source, char value, StringComparison comparison)
    Parameters
    Type Name Description
    System.String source

    The System.String to seek.

    System.Char value

    The System.Char to search within source.

    System.StringComparison comparison

    One of the enumeration values that specifies the rules to use in the comparison.

    Returns
    Type Description
    System.Boolean

    true if the value parameter occurs within the source, or if value is the empty string (""); otherwise, false.

    | Improve this Doc

    Contains(String, Char[])

    Returns a value indicating whether any of the specified values occurs within the source.

    Declaration
    public static bool Contains(string source, params char[] values)
    Parameters
    Type Name Description
    System.String source

    The System.String to seek.

    System.Char[] values

    The System.Char sequence to search within source.

    Returns
    Type Description
    System.Boolean

    true if any of the values occurs within the source, or if value is the empty string (""); otherwise, false.

    Remarks

    This method performs an ordinal (case-sensitive and culture-insensitive) comparison. The search begins at the first character position of this string and continues through the last character position.

    | Improve this Doc

    Contains(String, String)

    Returns a value indicating whether the specified value occurs within the source.

    Declaration
    public static bool Contains(string source, string value)
    Parameters
    Type Name Description
    System.String source

    The System.String to seek.

    System.String value

    The System.String to search within source.

    Returns
    Type Description
    System.Boolean

    true if the value parameter occurs within the source, or if value is the empty string (""); otherwise, false.

    Remarks

    This method performs an ordinal (case-insensitive and culture-insensitive) comparison. The search begins at the first character position of this string and continues through the last character position.

    | Improve this Doc

    Contains(String, String, StringComparison)

    Returns a value indicating whether the specified value occurs within the source.

    Declaration
    public static bool Contains(string source, string value, StringComparison comparison)
    Parameters
    Type Name Description
    System.String source

    The System.String to seek.

    System.String value

    The System.String to search within source.

    System.StringComparison comparison

    One of the enumeration values that specifies the rules to use in the comparison.

    Returns
    Type Description
    System.Boolean

    true if the value parameter occurs within the source, or if value is the empty string (""); otherwise, false.

    | Improve this Doc

    Contains(String, String[])

    Returns a value indicating whether the specified values occurs within the source.

    Declaration
    public static bool Contains(string source, params string[] values)
    Parameters
    Type Name Description
    System.String source

    The System.String to seek.

    System.String[] values

    The System.String sequence to search within source.

    Returns
    Type Description
    System.Boolean

    true if the values parameter occurs within the source, or if value is the empty string (""); otherwise, false.

    Remarks

    This method performs an ordinal (case-insensitive and culture-insensitive) comparison. The search begins at the first character position of this string and continues through the last character position.

    | Improve this Doc

    Contains(String, StringComparison, Char[])

    Returns a value indicating whether any of the specified values occurs within the source.

    Declaration
    public static bool Contains(string source, StringComparison comparison, params char[] values)
    Parameters
    Type Name Description
    System.String source

    The System.String to seek.

    System.StringComparison comparison

    One of the enumeration values that specifies the rules to use in the comparison.

    System.Char[] values

    The System.Char sequence to search within source.

    Returns
    Type Description
    System.Boolean

    true if any of the values occurs within the source, or if value is the empty string (""); otherwise, false.

    | Improve this Doc

    Contains(String, StringComparison, String[])

    Returns a value indicating whether any of the specified values occurs within the source.

    Declaration
    public static bool Contains(string source, StringComparison comparison, params string[] values)
    Parameters
    Type Name Description
    System.String source

    The System.String to seek.

    System.StringComparison comparison

    One of the enumeration values that specifies the rules to use in the comparison.

    System.String[] values

    The System.String sequence to search within source.

    Returns
    Type Description
    System.Boolean

    true if any of the values occurs within the source, or if value is the empty string (""); otherwise, false.

    | Improve this Doc

    Count(String, Char)

    Counts the occurrences of character in the specified source.

    Declaration
    public static int Count(string source, char character)
    Parameters
    Type Name Description
    System.String source

    The source to count occurrences of character.

    System.Char character

    The System.Char value to count in source.

    Returns
    Type Description
    System.Int32

    The number of times the character was found in the source.

    Exceptions
    Type Condition
    System.ArgumentNullException

    source is null.

    | Improve this Doc

    CreateFixedString(Char, Int32)

    Generates a string from the specified Unicode character repeated until the specified length.

    Declaration
    public static string CreateFixedString(char character, int length)
    Parameters
    Type Name Description
    System.Char character

    A Unicode character.

    System.Int32 length

    The number of times character occurs.

    Returns
    Type Description
    System.String

    A System.String filled with the specified character until the specified length.

    | Improve this Doc

    CreateRandomString(Int32)

    Generates a random string with the specified length using values of AlphanumericCharactersCaseSensitive.

    Declaration
    public static string CreateRandomString(int length)
    Parameters
    Type Name Description
    System.Int32 length

    The length of the random string to generate.

    Returns
    Type Description
    System.String

    A random string from the values of AlphanumericCharactersCaseSensitive.

    | Improve this Doc

    CreateRandomString(Int32, String[])

    Generates a random string with the specified length from the provided values.

    Declaration
    public static string CreateRandomString(int length, params string[] values)
    Parameters
    Type Name Description
    System.Int32 length

    The length of the random string to generate.

    System.String[] values

    The values to use in the randomization process.

    Returns
    Type Description
    System.String

    A random string from the values provided.

    | Improve this Doc

    Equals(String, String[])

    Returns a value indicating the specified source equals one of the specified values.

    Declaration
    public static bool Equals(string source, params string[] values)
    Parameters
    Type Name Description
    System.String source

    The System.String to seek.

    System.String[] values

    The System.String sequence to search within source.

    Returns
    Type Description
    System.Boolean

    true if one the values is the same as the source; otherwise false.

    Remarks

    This method performs an ordinal (case-sensitive and culture-insensitive) comparison. The search begins at the first character position of this string and continues through the last character position.

    Exceptions
    Type Condition
    System.ArgumentNullException

    source is null - or - values is null.

    | Improve this Doc

    Equals(String, StringComparison, String[])

    Returns a value indicating the specified source equals one of the specified values.

    Declaration
    public static bool Equals(string source, StringComparison comparison, params string[] values)
    Parameters
    Type Name Description
    System.String source

    The System.String to seek.

    System.StringComparison comparison

    One of the enumeration values that specifies the rules to use in the comparison.

    System.String[] values

    The System.String sequence to search within source.

    Returns
    Type Description
    System.Boolean

    true if one the values is the same as the source; otherwise false.

    Exceptions
    Type Condition
    System.ArgumentNullException

    source is null - or - values is null.

    | Improve this Doc

    Escape(String)

    Escapes the given System.String the same way as the well known JavaScrip escape() function.

    Declaration
    public static string Escape(string value)
    Parameters
    Type Name Description
    System.String value

    The System.String to escape.

    Returns
    Type Description
    System.String

    The input value with an escaped equivalent.

    | Improve this Doc

    GetHashCode(String)

    Computes a suitable hash code from the specified System.String value.

    Declaration
    public static int GetHashCode(string value)
    Parameters
    Type Name Description
    System.String value

    A System.String value.

    Returns
    Type Description
    System.Int32

    A 32-bit signed integer that is the hash code of value.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null.

    | Improve this Doc

    HasConsecutiveCharacters(String, Char, Int32)

    Determines whether the specified value contains a succession character of length.

    Declaration
    public static bool HasConsecutiveCharacters(string value, char character, int length = 2)
    Parameters
    Type Name Description
    System.String value

    The value to test for consecutive characters.

    System.Char character

    The characters to locate with the specified length.

    System.Int32 length

    The number of characters in succession.

    Returns
    Type Description
    System.Boolean

    true if the specified value contains a succession character of length; otherwise, false.

    | Improve this Doc

    HasConsecutiveCharacters(String, IEnumerable<Char>, Int32)

    Determines whether the specified value contains at least one of the succession characters of length.

    Declaration
    public static bool HasConsecutiveCharacters(string value, IEnumerable<char> characters, int length = 2)
    Parameters
    Type Name Description
    System.String value

    The value to test for consecutive characters.

    System.Collections.Generic.IEnumerable<System.Char> characters

    The character to locate with the specified length.

    System.Int32 length

    The number of characters in succession.

    Returns
    Type Description
    System.Boolean

    true if the specified value contains at least one of the succession characters of length; otherwise, false.

    | Improve this Doc

    IsBase64(String)

    Determines whether the specified value matches a Base64 structure.

    Declaration
    public static bool IsBase64(string value)
    Parameters
    Type Name Description
    System.String value

    The value to test for a Base64 structure.

    Returns
    Type Description
    System.Boolean

    true if the specified value matches a Base64 structure; otherwise, false.

    Remarks

    This method will skip common Base64 structures typically used as checksums. This includes 32, 128, 160, 256, 384 and 512 bit checksums.

    | Improve this Doc

    IsBase64(String, Func<String, Boolean>)

    Determines whether the specified value matches a Base64 structure.

    Declaration
    public static bool IsBase64(string value, Func<string, bool> predicate)
    Parameters
    Type Name Description
    System.String value

    The value to test for a Base64 structure.

    System.Func<System.String, System.Boolean> predicate

    A function delegate that provides custom rules for bypassing the Base64 structure check.

    Returns
    Type Description
    System.Boolean

    true if the specified value matches a Base64 structure; otherwise, false.

    | Improve this Doc

    IsCountableSequence(String)

    Determines whether the specified value is a sequence of countable characters (hence, characters being either incremented or decremented with the same cardinality through out the sequence).

    Declaration
    public static bool IsCountableSequence(string value)
    Parameters
    Type Name Description
    System.String value

    The value to test for a sequence of countable characters.

    Returns
    Type Description
    System.Boolean

    true if the specified value is a sequence of countable characters (hence, characters being either incremented or decremented with the same cardinality through out the sequence); otherwise, false.

    | Improve this Doc

    IsNullOrEmpty(IEnumerable<String>)

    Determines whether a string sequence has at least one value that equals to null or empty.

    Declaration
    public static bool IsNullOrEmpty(IEnumerable<string> values)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.String> values

    A string sequence in which to test for the presence of null or empty.

    Returns
    Type Description
    System.Boolean

    true if a string sequence has at least one value that equals to null or empty; otherwise, false.

    | Improve this Doc

    IsNullOrEmpty(String[])

    Determines whether one or more string values equals to null or empty.

    Declaration
    public static bool IsNullOrEmpty(params string[] values)
    Parameters
    Type Name Description
    System.String[] values

    One or more string values to test for the presence of null or empty.

    Returns
    Type Description
    System.Boolean

    true if one or more string values equals to null or empty; otherwise, false.

    | Improve this Doc

    IsSequenceOf<T>(IEnumerable<String>)

    Determines whether the elements of the specified source is equivalent to the specified T.

    Declaration
    public static bool IsSequenceOf<T>(IEnumerable<string> source)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.String> source

    A sequence in which to evaluate if a string value is equivalent to the specified T.

    Returns
    Type Description
    System.Boolean

    true if elements of the source parameter was successfully converted; otherwise false.

    Type Parameters
    Name Description
    T

    The type of the expected values contained within the sequence of source.

    | Improve this Doc

    IsSequenceOf<T>(IEnumerable<String>, Func<String, CultureInfo, Boolean>)

    Determines whether the elements of the specified source is equivalent to the specified T.

    Declaration
    public static bool IsSequenceOf<T>(IEnumerable<string> source, Func<string, CultureInfo, bool> parser)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.String> source

    A sequence in which to evaluate if a string value is equivalent to the specified T.

    System.Func<System.String, System.Globalization.CultureInfo, System.Boolean> parser

    The function delegate that evaluates if the elements of source is equivalent to the specified T.

    Returns
    Type Description
    System.Boolean

    true if elements of the source parameter was successfully converted; otherwise false.

    Type Parameters
    Name Description
    T

    The type of the expected values contained within the sequence of source.

    | Improve this Doc

    IsSequenceOf<T>(IEnumerable<String>, CultureInfo)

    Determines whether the elements of the specified source is equivalent to the specified T.

    Declaration
    public static bool IsSequenceOf<T>(IEnumerable<string> source, CultureInfo culture)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.String> source

    A sequence in which to evaluate if a string value is equivalent to the specified T.

    System.Globalization.CultureInfo culture

    The culture-specific formatting information to apply on the elements within source.

    Returns
    Type Description
    System.Boolean

    true if elements of the source parameter was successfully converted; otherwise false.

    Type Parameters
    Name Description
    T

    The type of the expected values contained within the sequence of source.

    | Improve this Doc

    IsSequenceOf<T>(IEnumerable<String>, CultureInfo, ITypeDescriptorContext)

    Determines whether the elements of the specified source is equivalent to the specified T.

    Declaration
    public static bool IsSequenceOf<T>(IEnumerable<string> source, CultureInfo culture, ITypeDescriptorContext context)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.String> source

    A sequence in which to evaluate if a string value is equivalent to the specified T.

    System.Globalization.CultureInfo culture

    The culture-specific formatting information to apply on the elements within source.

    System.ComponentModel.ITypeDescriptorContext context

    The type-specific formatting information to apply on the elements within source.

    Returns
    Type Description
    System.Boolean

    true if elements of the source parameter was successfully converted; otherwise false.

    Type Parameters
    Name Description
    T

    The type of the expected values contained within the sequence of source.

    | Improve this Doc

    IsSequenceOf<T>(IEnumerable<String>, CultureInfo, Func<String, CultureInfo, Boolean>)

    Determines whether the elements of the specified source is equivalent to the specified T.

    Declaration
    public static bool IsSequenceOf<T>(IEnumerable<string> source, CultureInfo culture, Func<string, CultureInfo, bool> parser)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.String> source

    A sequence in which to evaluate if a string value is equivalent to the specified T.

    System.Globalization.CultureInfo culture

    The culture-specific formatting information to apply on the elements within source.

    System.Func<System.String, System.Globalization.CultureInfo, System.Boolean> parser

    The function delegate that evaluates if the elements of source is equivalent to the specified T.

    Returns
    Type Description
    System.Boolean

    true if elements of the source parameter was successfully converted; otherwise false.

    Type Parameters
    Name Description
    T

    The type of the expected values contained within the sequence of source.

    | Improve this Doc

    ParseDistinctDifference(String, String, out String)

    Parses whether the two specified values has a distinct difference from each other.

    Declaration
    public static bool ParseDistinctDifference(string definite, string arbitrary, out string difference)
    Parameters
    Type Name Description
    System.String definite

    The value that specifies valid characters.

    System.String arbitrary

    The value to distinctively compare with definite.

    System.String difference

    The distinct difference between arbitrary and definite or System.String.Empty if no difference.

    Returns
    Type Description
    System.Boolean

    true if there is a distinct difference between arbitrary and definite; otherwise false.

    | Improve this Doc

    ParseFormat(String, Int32, out Int32)

    Parses the given string for any format arguments (eg. Text{0}-{1}.).

    Declaration
    public static bool ParseFormat(string format, int maxArguments, out int foundArguments)
    Parameters
    Type Name Description
    System.String format

    The desired string format to parse.

    System.Int32 maxArguments

    The maximum allowed arguments in the string format.

    System.Int32 foundArguments

    The number of arguments found in the string format.

    Returns
    Type Description
    System.Boolean

    true if one or more format arguments is found and the found arguments does not exceed the maxArguments parameter; otherwise false.

    | Improve this Doc

    ParseFormat(String, out Int32)

    Parses the given string for any format arguments (eg. Text{0}-{1}.).

    Declaration
    public static bool ParseFormat(string format, out int foundArguments)
    Parameters
    Type Name Description
    System.String format

    The desired string format to parse.

    System.Int32 foundArguments

    The number of arguments found in the string format.

    Returns
    Type Description
    System.Boolean

    true if one or more format arguments is found; otherwise false.

    | Improve this Doc

    RemoveAll(String, Char[])

    Returns a new string in which all the specified filter values has been deleted from the specified source.

    Declaration
    public static string RemoveAll(string source, params char[] filter)
    Parameters
    Type Name Description
    System.String source

    The source to delete occurrences found in filter.

    System.Char[] filter

    The filter containing the characters and/or words to delete.

    Returns
    Type Description
    System.String

    A new string that is equivalent to source except for the removed characters.

    | Improve this Doc

    RemoveAll(String, String[])

    Returns a new string in which all the specified filter values has been deleted from the specified source.

    Declaration
    public static string RemoveAll(string source, params string[] filter)
    Parameters
    Type Name Description
    System.String source

    The source to delete occurrences found in filter.

    System.String[] filter

    The filter containing the characters and/or words to delete.

    Returns
    Type Description
    System.String

    A new string that is equivalent to source except for the removed characters and/or words.

    Remarks

    This method performs an ordinal (case-sensitive and culture-insensitive) comparison. The search begins at the first character position of this string and continues through the last character position.

    | Improve this Doc

    RemoveAll(String, StringComparison, String[])

    Returns a new string in which all the specified filter values has been deleted from the specified source.

    Declaration
    public static string RemoveAll(string source, StringComparison comparison, params string[] filter)
    Parameters
    Type Name Description
    System.String source

    The source to delete occurrences found in filter.

    System.StringComparison comparison

    One of the enumeration values that specifies the rules to use in the comparison.

    System.String[] filter

    The filter containing the characters and/or words to delete.

    Returns
    Type Description
    System.String

    A new string that is equivalent to source except for the removed characters and/or words.

    | Improve this Doc

    RemoveAll(String[], String[])

    Returns a new string array in which all the specified filter values has been deleted from the specified source array.

    Declaration
    public static string[] RemoveAll(string[] source, params string[] filter)
    Parameters
    Type Name Description
    System.String[] source

    The source array to delete occurrences found in filter.

    System.String[] filter

    The filter containing the characters and/or words to delete.

    Returns
    Type Description
    System.String[]

    A new string array that is equivalent to source except for the removed characters and/or words.

    Remarks

    This method performs an ordinal (case-sensitive and culture-insensitive) comparison. The search begins at the first character position of this string and continues through the last character position.

    | Improve this Doc

    RemoveAll(String[], StringComparison, String[])

    Returns a new string array in which all the specified filter values has been deleted from the specified source array.

    Declaration
    public static string[] RemoveAll(string[] source, StringComparison comparison, params string[] filter)
    Parameters
    Type Name Description
    System.String[] source

    The source array to delete occurrences found in filter.

    System.StringComparison comparison

    One of the enumeration values that specifies the rules to use in the comparison.

    System.String[] filter

    The filter containing the characters and/or words to delete.

    Returns
    Type Description
    System.String[]

    A new string array that is equivalent to source except for the removed characters and/or words.

    | Improve this Doc

    Replace(String, IEnumerable<StringReplacePair>, StringComparison)

    Replaces all occurrences of the OldValue with NewValue of the replacePairs sequence in value.

    Declaration
    public static string Replace(string value, IEnumerable<StringReplacePair> replacePairs, StringComparison comparison)
    Parameters
    Type Name Description
    System.String value

    The System.String value to perform the replacement on.

    System.Collections.Generic.IEnumerable<StringReplacePair> replacePairs

    A sequence of StringReplacePair values.

    System.StringComparison comparison

    One of the enumeration values that specifies the rules to use in the comparison.

    Returns
    Type Description
    System.String

    A System.String equivalent to value but with all instances of OldValue replaced with NewValue.

    | Improve this Doc

    Replace(String, String, String)

    Replaces all occurrences of oldValue in value, with newValue.

    Declaration
    public static string Replace(string value, string oldValue, string newValue)
    Parameters
    Type Name Description
    System.String value

    The System.String value to perform the replacement on.

    System.String oldValue

    The System.String value to be replaced.

    System.String newValue

    The System.String value to replace all occurrences of oldValue.

    Returns
    Type Description
    System.String

    A System.String equivalent to value but with all instances of oldValue replaced with newValue.

    Remarks

    This method performs an System.StringComparison.OrdinalIgnoreCase search to find oldValue.

    | Improve this Doc

    Replace(String, String, String, StringComparison)

    Replaces all occurrences of oldValue in value, with newValue.

    Declaration
    public static string Replace(string value, string oldValue, string newValue, StringComparison comparison)
    Parameters
    Type Name Description
    System.String value

    The System.String value to perform the replacement on.

    System.String oldValue

    The System.String value to be replaced.

    System.String newValue

    The System.String value to replace all occurrences of oldValue.

    System.StringComparison comparison

    One of the enumeration values that specifies the rules to use in the comparison.

    Returns
    Type Description
    System.String

    A System.String equivalent to value but with all instances of oldValue replaced with newValue.

    | Improve this Doc

    Shuffle(IEnumerable<String>)

    Shuffles the specified values like a deck of cards.

    Declaration
    public static string Shuffle(IEnumerable<string> values)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.String> values

    The values to be shuffled in the randomization process.

    Returns
    Type Description
    System.String

    A random string from the shuffled values provided.

    Exceptions
    Type Condition
    System.ArgumentNullException

    values is null.

    System.ArgumentOutOfRangeException

    values is empty.

    | Improve this Doc

    Shuffle(String[])

    Shuffles the specified values like a deck of cards.

    Declaration
    public static string Shuffle(params string[] values)
    Parameters
    Type Name Description
    System.String[] values

    The values to be shuffled in the randomization process.

    Returns
    Type Description
    System.String

    A random string from the shuffled values provided.

    Exceptions
    Type Condition
    System.ArgumentNullException

    values is null.

    System.ArgumentOutOfRangeException

    values is empty.

    | Improve this Doc

    Split(String)

    Returns a string array that contains the substrings of value that are delimited by a comma (",").

    Declaration
    public static string[] Split(string value)
    Parameters
    Type Name Description
    System.String value

    The value containing substrings and delimiters.

    Returns
    Type Description
    System.String[]

    An array whose elements contain the substrings of value that are delimited by a comma (",").

    Remarks

    The following table shows the default values for the overloads of this method.

    ParameterDefault Value
    delimiter,
    textQualifier"
    providerSystem.Globalization.CultureInfo.InvariantCulture
    | Improve this Doc

    Split(String, String)

    Returns a string array that contains the substrings of value that are delimited by delimiter.

    Declaration
    public static string[] Split(string value, string delimiter)
    Parameters
    Type Name Description
    System.String value

    The value containing substrings and delimiters.

    System.String delimiter

    The delimiter specification.

    Returns
    Type Description
    System.String[]

    An array whose elements contain the substrings of value that are delimited by delimiter.

    | Improve this Doc

    Split(String, String, String)

    Returns a string array that contains the substrings of value that are delimited by delimiter. A parameter specifies the textQualifier that surrounds a field.

    Declaration
    public static string[] Split(string value, string delimiter, string textQualifier)
    Parameters
    Type Name Description
    System.String value

    The value containing substrings and delimiters.

    System.String delimiter

    The delimiter specification.

    System.String textQualifier

    The text qualifier specification that surrounds a field.

    Returns
    Type Description
    System.String[]

    An array whose elements contain the substrings of value that are delimited by delimiter.

    | Improve this Doc

    Split(String, String, String, IFormatProvider)

    Returns a string array that contains the substrings of value that are delimited by delimiter. A parameter specifies the textQualifier that surrounds a field.

    Declaration
    public static string[] Split(string value, string delimiter, string textQualifier, IFormatProvider provider)
    Parameters
    Type Name Description
    System.String value

    The value containing substrings and delimiters.

    System.String delimiter

    The delimiter specification.

    System.String textQualifier

    The text qualifier specification that surrounds a field.

    System.IFormatProvider provider

    An System.IFormatProvider that supplies culture-specific formatting information.

    Returns
    Type Description
    System.String[]

    An array whose elements contain the substrings of value that are delimited by delimiter.

    Remarks

    This method was inspired by an article on StackOverflow @ http://stackoverflow.com/questions/2807536/split-string-in-c-sharp.

    | Improve this Doc

    StartsWith(String, IEnumerable<String>)

    Determines whether the beginning of an instance of System.String matches at least one string in the specified sequence of strings.

    Declaration
    public static bool StartsWith(string value, IEnumerable<string> startWithValues)
    Parameters
    Type Name Description
    System.String value

    The System.String to compare.

    System.Collections.Generic.IEnumerable<System.String> startWithValues

    A sequence of System.String values to match against.

    Returns
    Type Description
    System.Boolean

    true if at least one value matches the beginning of this string; otherwise, false.

    Remarks

    This match is performed by using a default value of System.StringComparison.OrdinalIgnoreCase.

    | Improve this Doc

    StartsWith(String, String[])

    Determines whether the beginning of an instance of System.String matches at least one string in the specified sequence of strings.

    Declaration
    public static bool StartsWith(string value, params string[] startWithValues)
    Parameters
    Type Name Description
    System.String value

    The System.String to compare.

    System.String[] startWithValues

    A sequence of System.String values to match against.

    Returns
    Type Description
    System.Boolean

    true if at least one value matches the beginning of this string; otherwise, false.

    Remarks

    This match is performed by using a default value of System.StringComparison.OrdinalIgnoreCase.

    | Improve this Doc

    StartsWith(String, StringComparison, IEnumerable<String>)

    Determines whether the beginning of an instance of System.String matches at least one string in the specified sequence of strings.

    Declaration
    public static bool StartsWith(string value, StringComparison comparison, IEnumerable<string> startWithValues)
    Parameters
    Type Name Description
    System.String value

    The System.String to compare.

    System.StringComparison comparison

    One of the enumeration values that specifies the rules to use in the comparison.

    System.Collections.Generic.IEnumerable<System.String> startWithValues

    A sequence of System.String values to match against.

    Returns
    Type Description
    System.Boolean

    true if at least one value matches the beginning of this string; otherwise, false.

    | Improve this Doc

    StartsWith(String, StringComparison, String[])

    Determines whether the beginning of an instance of System.String matches at least one string in the specified sequence of strings.

    Declaration
    public static bool StartsWith(string value, StringComparison comparison, params string[] startWithValues)
    Parameters
    Type Name Description
    System.String value

    The System.String to compare.

    System.StringComparison comparison

    One of the enumeration values that specifies the rules to use in the comparison.

    System.String[] startWithValues

    A sequence of System.String values to match against.

    Returns
    Type Description
    System.Boolean

    true if at least one value matches the beginning of this string; otherwise, false.

    Remarks

    This match is performed by using a default value of System.StringComparison.OrdinalIgnoreCase.

    | Improve this Doc

    TrimAll(String)

    Removes all occurrences of white-space characters from the specified value.

    Declaration
    public static string TrimAll(string value)
    Parameters
    Type Name Description
    System.String value

    A System.String value.

    Returns
    Type Description
    System.String

    The string that remains after all occurrences of white-space characters are removed from the specified value.

    | Improve this Doc

    TrimAll(String, Char[])

    Removes all occurrences of a set of characters specified in trimChars from the specified value.

    Declaration
    public static string TrimAll(string value, params char[] trimChars)
    Parameters
    Type Name Description
    System.String value

    A System.String value.

    System.Char[] trimChars

    An array of Unicode characters to remove.

    Returns
    Type Description
    System.String

    The string that remains after all occurrences of the characters in the trimChars parameter are removed from the specified value.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null.

    | Improve this Doc

    Unescape(String)

    Unescapes the given System.String the same way as the well known Javascript unescape() function.

    Declaration
    public static string Unescape(string value)
    Parameters
    Type Name Description
    System.String value

    The System.String to unescape.

    Returns
    Type Description
    System.String

    The input value with an unescaped equivalent.

    • Improve this Doc
    • View Source
    Back to top Copyright 2008-2018 Weubphoria. All rights reserved.
    Generated by DocFX