Method BeforeFirst
BeforeFirst(String, String)
Returns the portion of value that occurs before the first instance of searchValue.
Declaration
public static string BeforeFirst(this string value, string searchValue)
Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | value | The value to search in.  | 
    
| System.String | searchValue | The value to search for.  | 
    
Returns
| Type | Description | 
|---|---|
| System.String | Either null, or a new string containing the portion of the string prior to   | 
    
Remarks
Returns null if searchValue is null, empty string or if searchValue does not occur within value.
Matching of searchValue is done using a System.StringComparison.Ordinal comparison.
BeforeFirst(String, String, StringComparison)
Returns the portion of value that occurs before the first instance of searchValue.
Declaration
public static string BeforeFirst(this string value, string searchValue, StringComparison comparisonMethod)
Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | value | The value to search in.  | 
    
| System.String | searchValue | The value to search for.  | 
    
| System.StringComparison | comparisonMethod | A value from the System.StringComparison enum specfying how   | 
    
Returns
| Type | Description | 
|---|---|
| System.String | Either null, or a new string containing the portion of the string prior to   | 
    
Remarks
Returns null if searchValue is null, empty string or if searchValue does not occur within value.