Method RemoveAllExcept
RemoveAllExcept(String, Char[])
Removes all characters that are not (latin) alphabet characters (A-Z, a-z) or numerics (0-9).
Declaration
public static string RemoveAllExcept(this string value, params char[] characters)
Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | value | The string to remove characters from.  | 
    
| System.Char[] | characters | An enumerable of System.Char instances representing allowed characters (that will not be removed).  | 
    
Returns
| Type | Description | 
|---|---|
| System.String | Either the original string if no changes were made, or else   | 
    
Remarks
Returns the original value if it is null, empty string, or does not contain any non-latin alphabet or numeric characters.
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | Thrown if   | 
    
RemoveAllExcept(String, IEnumerable<Char>)
Removes all characters that are not (latin) alphabet characters (A-Z, a-z) or numerics (0-9).
Declaration
public static string RemoveAllExcept(this string value, IEnumerable<char> characters)
Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | value | The string to remove characters from.  | 
    
| System.Collections.Generic.IEnumerable<System.Char> | characters | An enumerable of System.Char instances representing allowed characters (that will not be removed).  | 
    
Returns
| Type | Description | 
|---|---|
| System.String | Either the original string if no changes were made, or else   | 
    
Remarks
Returns the original value if it is null, empty string, or does not contain any non-latin alphabet or numeric characters.
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | Thrown if   |