/String.Extensions

Provides custom methods to C# String type

Primary LanguageC#

String.Extensions

This library helps you with String manipulation, avoiding repetitive syntax and regex use. All methods extend from default String type.

To download String.Extensions, using the Package Manager Console, type:

Install-Package String.Extensions

Or using the Nuget Package Manager, search for String.Extensions.

Alt text

Current methods avaliable are:

Method Description Parameters
Remove(params string[] toRemove) This method allows you to pass multiple Strings to be removed toRemove: List of values to be removed.
Remove(bool ignoreCase, params string[] toRemove) Replaces multiple elements with one same element specified. Case will be considered. ignoreCase: Ignore the case of the value to be removed.
toRemove: List of values to be removed.
RemoveAllNumbers() Removes all numbers, keeping alphabetical letters and special characters.
RemoveAllSpecialCharacters() Removes all special characters, keeping alphabetical letters and numbers.
RemoveAllAlphabeticalLetters() Removes all alphabetical letters, keeping special characters and numbers.
Replace(string replacerString, params string[] toReplace) Replaces multiple elements with one same element specified. Case will be considered. replacerString: New value.
toReplace: List of old values
Replace(bool ignoreCase, string replacerString, params string[] toReplace) Replaces multiple elements with one same element specified. Case can be considered or not. ignoreCase: Ignore the case of the old value.
replacerString: New value.
toReplace: List of old values
KeepOnlyNumbers() Keeps all numbers, removing alphabetical letters and special characters.
KeepAllSpecialCharacters() Keeps all special characters, removing alphabetical letters and numbers.
KeepOnlyAlphabeticalLetters() Keeps all alphabetical letters, removing special characters and numbers.

More methods will be added soon!

Feel free to fork and help improve this library.