Show / Hide Table of Contents

    Class StringExtensions

    This is an extension implementation of the System.String class using various methods already found in the Microsoft .NET Framework.

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

    Methods

    | Improve this Doc

    FormatWith(String, IFormatProvider, Object[])

    Replaces the format item in a specified string with the string representation of a corresponding object in a specified array.

    Declaration
    public static string FormatWith(this string format, IFormatProvider provider, params object[] args)
    Parameters
    Type Name Description
    System.String format

    A composite format string.

    System.IFormatProvider provider

    An object that supplies culture-specific formatting information.

    System.Object[] args

    An object array that contains zero or more objects to format.

    Returns
    Type Description
    System.String

    A copy of format in which the format items have been replaced by the string representation of the corresponding objects in args.

    | Improve this Doc

    FormatWith(String, Object[])

    Replaces the format item in a specified string with the string representation of a corresponding object in a specified array.

    Declaration
    public static string FormatWith(this string format, params object[] args)
    Parameters
    Type Name Description
    System.String format

    A composite format string.

    System.Object[] args

    An object array that contains zero or more objects to format.

    Returns
    Type Description
    System.String

    A copy of format in which the format items have been replaced by the string representation of the corresponding objects in args.

    | Improve this Doc

    FromBase64(String)

    Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array.

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

    The string to convert.

    Returns
    Type Description
    System.Byte[]

    An array of 8-bit unsigned integers that is equivalent to value.

    | Improve this Doc

    IsNullOrEmpty(String)

    Determines whether the specified value is null or an System.String.Empty string.

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

    The string to test.

    Returns
    Type Description
    System.Boolean

    true if the value is null or an empty string (""); otherwise, false.

    | Improve this Doc

    IsNullOrWhiteSpace(String)

    Determines whether the specified value is null, empty, or consists only of white-space characters.

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

    The string to test.

    Returns
    Type Description
    System.Boolean

    true if the value parameter is null or an empty string (""), or if value consists exclusively of white-space characters; otherwise, false.

    | Improve this Doc

    Join(String[], String)

    Concatenates all the elements of a string array, using the specified separator between each element.

    Declaration
    public static string Join(this string[] value, string separator)
    Parameters
    Type Name Description
    System.String[] value

    An array that contains the elements to concatenate.

    System.String separator

    The string to use as a separator. The separator is included in the returned string only if value has more than one element.

    Returns
    Type Description
    System.String

    A string that consists of the elements in value delimited by the separator string. If value is an empty array, the method returns System.String.Empty.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null.

    | Improve this Doc

    Join(String[], String, Int32, Int32)

    Concatenates all the elements of a string array, using the specified separator between each element.

    Declaration
    public static string Join(this string[] value, string separator, int startIndex, int count)
    Parameters
    Type Name Description
    System.String[] value

    An array that contains the elements to concatenate.

    System.String separator

    The string to use as a separator. The separator is included in the returned string only if value has more than one element.

    System.Int32 startIndex

    The first element in value to use.

    System.Int32 count

    The number of elements of value to use.

    Returns
    Type Description
    System.String

    A string that consists of the elements in value delimited by the separator string. If value is an empty array, the method returns System.String.Empty.

    Exceptions
    Type Condition
    System.ArgumentNullException

    value is null.

    | Improve this Doc

    SubstringBefore(String, String, StringComparison)

    Retrieves a substring from the specified value. The substring starts at position 0 and continues until the first occurrence of match.

    Declaration
    public static string SubstringBefore(this string value, string match, StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)
    Parameters
    Type Name Description
    System.String value

    The System.String to extend.

    System.String match

    The match that will define the stopping point.

    System.StringComparison comparisonType

    One of the enumeration values that specifies the rules for the search.

    Returns
    Type Description
    System.String

    A substring that contains only the value just before match.

    | Improve this Doc

    ToCasing(String, CasingMethod)

    Converts the specified value to either lowercase, UPPERCASE, Title Case or unaltered.

    Declaration
    public static string ToCasing(this string value, CasingMethod method)
    Parameters
    Type Name Description
    System.String value

    The value to convert to one of the values in CasingMethod.

    CasingMethod method

    The method to use in the conversion.

    Returns
    Type Description
    System.String

    A System.String that corresponds to value with the applied conversion method.

    Remarks

    Uses System.Globalization.CultureInfo.InvariantCulture for the conversion.

    | Improve this Doc

    ToCasing(String, CasingMethod, CultureInfo)

    Converts the specified value to either lowercase, UPPERCASE, Title Case or unaltered using the specified culture.

    Declaration
    public static string ToCasing(this string value, CasingMethod method, CultureInfo culture)
    Parameters
    Type Name Description
    System.String value

    The value to convert to one of the values in CasingMethod.

    CasingMethod method

    The method to use in the conversion.

    System.Globalization.CultureInfo culture

    The culture rules to apply the conversion.

    Returns
    Type Description
    System.String

    A System.String that corresponds to value with the applied conversion method.

    | Improve this Doc

    ToUri(String)

    Converts the specified absolute uriString to its equivalent System.Uri representation.

    Declaration
    public static Uri ToUri(this string uriString)
    Parameters
    Type Name Description
    System.String uriString

    A string that identifies the resource to be represented by the System.Uri instance.

    Returns
    Type Description
    System.Uri

    A System.Uri that corresponds to uriString.

    Remarks

    This method uses the System.UriKind.Absolute when converting the uriString.

    | Improve this Doc

    ToUri(String, UriKind)

    Converts the specified uriString to its equivalent System.Uri representation.

    Declaration
    public static Uri ToUri(this string uriString, UriKind uriKind)
    Parameters
    Type Name Description
    System.String uriString

    A string that identifies the resource to be represented by the System.Uri instance.

    System.UriKind uriKind

    Specifies whether the URI string is a relative URI, absolute URI, or is indeterminate.

    Returns
    Type Description
    System.Uri

    A System.Uri that corresponds to uriString and uriKind.

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