Search Results for

    Show / Hide Table of Contents

    Class StringExtensions

    Class holding extension methods on the System.string class

    Inheritance
    System.Object
    StringExtensions
    Namespace: PnP.Framework.Modernization.Extensions
    Assembly: PnP.Framework.dll
    Syntax
    public static class StringExtensions : object

    Methods

    CleanForJSON(String)

    Prepares a string for json inclusion Copied from https://stackoverflow.com/questions/1242118/how-to-escape-json-string

    Declaration
    public static string CleanForJSON(this string s)
    Parameters
    System.String s

    string to prepare

    Returns
    System.String

    json ready string

    ContainsIgnoringCasing(String, String, StringComparison)

    Determines if a string exists in another string regardless of casing

    Declaration
    public static bool ContainsIgnoringCasing(this string value, string comparedWith, StringComparison stringComparison = null)
    Parameters
    System.String value

    original string

    System.String comparedWith

    string to compare with

    StringComparison stringComparison

    optional comparison mode

    Returns
    System.Boolean

    GetBaseUrl(String)

    Gets base url from string

    Declaration
    public static string GetBaseUrl(this string url)
    Parameters
    System.String url

    Returns
    System.String

    GetTypeShort(String)

    Get type in short form

    Declaration
    public static string GetTypeShort(this string typeValue)
    Parameters
    System.String typeValue

    Returns
    System.String

    GetUserName(String)

    Gets the user name from a provided login name

    Declaration
    public static string GetUserName(this string loginName)
    Parameters
    System.String loginName

    Login name

    Returns
    System.String

    User name

    InferClassNameFromNameSpace(String)

    Gets classname from type

    Declaration
    public static string InferClassNameFromNameSpace(this string typeName)
    Parameters
    System.String typeName

    Returns
    System.String

    PrependIfNotNull(String, String)

    Prepends string to another including null checking

    Declaration
    public static string PrependIfNotNull(this string value, string prependString)
    Parameters
    System.String value

    System.String prependString

    Returns
    System.String

    Replace(String, String, String, StringComparison)

    Returns a new string in which all occurrences of a specified string in the current instance are replaced with another specified string according the type of search to use for the specified string. Copied from https://stackoverflow.com/questions/6275980/string-replace-ignoring-case

    Declaration
    public static string Replace(this string str, string oldValue, string newValue, StringComparison comparisonType)
    Parameters
    System.String str

    The string performing the replace method.

    System.String oldValue

    The string to be replaced.

    System.String newValue

    The string replace all occurrences of oldValue. If value is equal to null, than all occurrences of oldValue will be removed from the str.

    StringComparison comparisonType

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

    Returns
    System.String

    A string that is equivalent to the current string except that all instances of oldValue are replaced with newValue. If oldValue is not found in the current instance, the method returns the current instance unchanged.

    StripRelativeUrlSectionString(String)

    Removes a relative section of by string where context not available

    Declaration
    public static string StripRelativeUrlSectionString(this string value)
    Parameters
    System.String value

    Returns
    System.String

    Back to top PnP Framework
    Generated by DocFX with Material UI
    spacer