Show / Hide Table of Contents

    Class StringExtensions

    Static class that contains helper extension methods for strings.

    Inheritance
    System.Object
    StringExtensions
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Fibula.Common.Utilities.Extensions
    Assembly: Fibula.Common.Utilities.dll
    Syntax
    public static class StringExtensions

    Methods

    | Improve this Doc View Source

    GetEnclosedStrings(String, IEnumerable<(Char openChar, Char closeChar)>)

    Retrieves the enclosed strings within a string.

    Declaration
    public static IEnumerable<string> GetEnclosedStrings(this string str, IEnumerable<(char openChar, char closeChar)> openClosePairs)
    Parameters
    Type Name Description
    System.String str

    The string from which to retrieve the enclosured strings.

    System.Collections.Generic.IEnumerable<System.ValueTuple<System.Char, System.Char>> openClosePairs

    A collection of open and close characters between which to look for enclosed strings.

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

    A collection of enclosed string contained in the string.

    | Improve this Doc View Source

    SplitByToken(String, Char)

    Splits a string using the given token, but preserving any quoted strings.

    Declaration
    public static IEnumerable<string> SplitByToken(this string str, char token = ' ')
    Parameters
    Type Name Description
    System.String str

    The string to split.

    System.Char token

    Optional. The token to split by. Defaults to Fibula.Common.Utilities.Extensions.StringExtensions.Space.

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

    A collection of strings resulting from the split.

    | Improve this Doc View Source

    TrimEnclosures(String, IEnumerable<(Char openChar, Char closeChar)>)

    Trims the open and close chars from the string.

    Declaration
    public static string TrimEnclosures(this string inputStr, IEnumerable<(char openChar, char closeChar)> openClosePairs)
    Parameters
    Type Name Description
    System.String inputStr

    The string to trim the pairs from.

    System.Collections.Generic.IEnumerable<System.ValueTuple<System.Char, System.Char>> openClosePairs

    The collection of open and close pairs.

    Returns
    Type Description
    System.String

    The resulting string after trim.

    | Improve this Doc View Source

    TrimStartArticles(String)

    Trims the articles "a" and "an" out of the given string.

    Declaration
    public static string TrimStartArticles(this string fromString)
    Parameters
    Type Name Description
    System.String fromString

    The string to trim the articles from.

    Returns
    Type Description
    System.String

    The resulting stream.

    • Improve this Doc
    • View Source
    Back to top Copyright © 2018-2020 | The Fibula Project
    Generated using DocFX | Jose L. Nuñez de Caceres et al.