Search Results for

    Show / Hide Table of Contents

    Class StringExtensions

    A set of extensions methods over strings, useable in LINQ queries.

    Inheritance
    Object
    StringExtensions
    Namespace: Realms
    Assembly: Realm.dll
    Syntax
    public static class StringExtensions

    Methods

    | Improve this Doc View Source

    Contains(String, String, StringComparison)

    Returns a value indicating whether a specified substring occurs within this string.

    Declaration
    public static bool Contains(this string str, string value, StringComparison comparisonType)
    Parameters
    Type Name Description
    String str

    The original string.

    String value

    The string to seek.

    StringComparison comparisonType

    One of the enumeration values that determines how this string and value are compared.

    Returns
    Type Description
    Boolean

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

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown when str or value is null.

    ArgumentException

    Thrown when comparisonType is not a valid StringComparison value.

    | Improve this Doc View Source

    Like(String, String, Boolean)

    Performs a 'like' comparison between the specified string and pattern.

    Declaration
    public static bool Like(this string str, string pattern, bool caseSensitive = true)
    Parameters
    Type Name Description
    String str

    The string to compare against the pattern.

    String pattern

    The pattern to compare against.

    Boolean caseSensitive

    If set to true performs a case sensitive comparison.

    Returns
    Type Description
    Boolean

    true if the string matches the pattern, false otherwise.

    Remarks

    ? and are allowed where ? matches a single character and matches zero or more characters, such that ?bc* matches abcde and bbc, but does not match bcd.

    This extension method can be used in LINQ queries against the IQueryable returned from All<T>(). If used outside of a query context, it will use a Regex to perform the comparison using the same rules.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2020 Realm
    Generated by DocFX