Class StringExtensions
A set of extensions methods over strings, useable in LINQ queries.
Namespace: Realms
Assembly: Realm.dll
Syntax
public static class StringExtensions
Methods
| Improve this Doc View SourceContains(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 |
|
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when |
ArgumentException | Thrown when |
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 |
Returns
Type | Description |
---|---|
Boolean |
|
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(String). If used outside of a query context, it will use a Regex to perform the comparison using the same rules.