Show / Hide Table of Contents

    Class StringUtils

    String Utils

    Inheritance
    Object
    StringUtils
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Microsoft.Graph.Communications.Common
    Assembly: Microsoft.Graph.Communications.Common.dll
    Syntax
    public static class StringUtils

    Methods

    ConvertOrDefault<T>(String, T)

    Convert string to type or return default

    Declaration
    public static T ConvertOrDefault<T>(string value, T defaultValue = null)
    Parameters
    Type Name Description
    String value

    input value

    T defaultValue

    default value

    Returns
    Type Description
    T

    result of the conversion

    Type Parameters
    Name Description
    T

    Type of return value

    EqualsIgnoreCase(String, String)

    Case insensitive string comparison

    Declaration
    public static bool EqualsIgnoreCase(this string valueA, string valueB)
    Parameters
    Type Name Description
    String valueA

    Input string A

    String valueB

    Input string B

    Returns
    Type Description
    Boolean

    Value indicating whether strings are equal in a case insensitive comparision

    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 data)
    Parameters
    Type Name Description
    String data

    The string to convert.

    Returns
    Type Description
    Byte[]

    An array of 8-bit unsigned integers.

    FromBase64Url(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[] FromBase64Url(this string data)
    Parameters
    Type Name Description
    String data

    The string to convert.

    Returns
    Type Description
    Byte[]

    An array of 8-bit unsigned integers.

    GetSHA256Hash(String)

    Creates a SHA256 hash of the passed string.

    Declaration
    public static string GetSHA256Hash(this string input)
    Parameters
    Type Name Description
    String input

    The input string.

    Returns
    Type Description
    String

    The SHA256 hash.

    Join(IEnumerable<String>, String)

    Concatenates the members of a constructed IEnumerable<T> collection of type String, using the specified separator between each member.

    Declaration
    public static string Join(this IEnumerable<string> values, string separator)
    Parameters
    Type Name Description
    IEnumerable<String> values

    A collection that contains the strings to concatenate.

    String separator

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

    Returns
    Type Description
    String

    A string that consists of the members of values delimited by the separator string. If values has no members, the method returns Empty.

    NamespaceInCamelCase(String)

    Returns a namespace in camel case.

    Declaration
    public static string NamespaceInCamelCase(this string value)
    Parameters
    Type Name Description
    String value

    Value to convert.

    Returns
    Type Description
    String

    The namespace string in camel case.

    NamespaceInPascalCase(String)

    Returns a namespace in pascal case.

    Declaration
    public static string NamespaceInPascalCase(this string value)
    Parameters
    Type Name Description
    String value

    Value to convert.

    Returns
    Type Description
    String

    The namespace string in pascal case.

    SafeFormat(String, Object[])

    Format a string with arguments.

    Declaration
    public static string SafeFormat(this string text, params object[] args)
    Parameters
    Type Name Description
    String text

    Format string.

    Object[] args

    Optional arguments.

    Returns
    Type Description
    String

    Formatted string.

    ToBase64(ArraySegment<Byte>, Nullable<Int32>, Nullable<Int32>)

    Convert array segment to base 64 representation.

    Declaration
    public static string ToBase64(this ArraySegment<byte> data, int? offset = default(int? ), int? count = default(int? ))
    Parameters
    Type Name Description
    ArraySegment<Byte> data

    Data to convert.

    Nullable<Int32> offset

    Optional override offset.

    Nullable<Int32> count

    Optional override count.

    Returns
    Type Description
    String

    Base 64 encoded string.

    ToBase64(Byte[])

    Convert byte array to base64.

    Declaration
    public static string ToBase64(this byte[] data)
    Parameters
    Type Name Description
    Byte[] data

    The data.

    Returns
    Type Description
    String

    Base64 representation.

    ToBase64Url(ArraySegment<Byte>, Nullable<Int32>, Nullable<Int32>)

    Convert array segment to base 64 URL representation.

    Declaration
    public static string ToBase64Url(this ArraySegment<byte> data, int? offset = default(int? ), int? count = default(int? ))
    Parameters
    Type Name Description
    ArraySegment<Byte> data

    Data to convert.

    Nullable<Int32> offset

    Optional override offset.

    Nullable<Int32> count

    Optional override count.

    Returns
    Type Description
    String

    Base 64 encoded string.

    ToCamelCase(String)

    Converts value to camel casing.

    Declaration
    public static string ToCamelCase(this string value)
    Parameters
    Type Name Description
    String value

    Value to convert.

    Returns
    Type Description
    String

    Returns string in camel case.

    ToPascalCase(String)

    Converts value to pascal casing.

    Declaration
    public static string ToPascalCase(this string value)
    Parameters
    Type Name Description
    String value

    Value to convert.

    Returns
    Type Description
    String

    Returns string in pascal case.

    TrimEnd(String, String)

    Remove a substring from the end of a given string. This is called iteratively.

    Declaration
    public static string TrimEnd(this string target, string trimString)
    Parameters
    Type Name Description
    String target

    The target.

    String trimString

    The trim string.

    Returns
    Type Description
    String

    The string after being trimmed.

    TrimStart(String, String)

    Remove a substring from the beginning of a given string. This is called iteratively.

    Declaration
    public static string TrimStart(this string target, string trimString)
    Parameters
    Type Name Description
    String target

    The target.

    String trimString

    The trim string.

    Returns
    Type Description
    String

    The string after being trimmed.

    Back to top Copyright (c) Microsoft Corporation. All rights reserved.