Stax.StringSanitizer
1.0.0
dotnet add package Stax.StringSanitizer --version 1.0.0
NuGet\Install-Package Stax.StringSanitizer -Version 1.0.0
<PackageReference Include="Stax.StringSanitizer" Version="1.0.0" />
paket add Stax.StringSanitizer --version 1.0.0
#r "nuget: Stax.StringSanitizer, 1.0.0"
// Install Stax.StringSanitizer as a Cake Addin #addin nuget:?package=Stax.StringSanitizer&version=1.0.0 // Install Stax.StringSanitizer as a Cake Tool #tool nuget:?package=Stax.StringSanitizer&version=1.0.0
String Sanitizer
This NuGet library contains extension methods to Sanitize common issues with strings, removing the complexity to implement or use Regex to solve common issues.
Features
- Remove emojis from a string
- Remove linebreaks from a string
- Remove URLs from a string
- Remove excessive spaces from a string (more than one occurrence of a space)
- Remove leading character if it is empty
- Remove ending character if it is empty
- Remove any non alphanumeric characters (with the option to disable/enable removing whitespaces too)
- Remove any numeric characters from a string (with the option to disable/enable removing whitespaces too)
- Remove credit cards from a string
Why I have written this
There are many questions on the internet asking how to Sanitize strings such as removing spaces, linebreaks or emojis. I wanted to create an easy to use extension method to take away the complexity of having to look up and therefore implement Regex to projects.
How to use
Once you have installed the StringSanitizer nuget package to your solution, you will be able to use this package. On any string you can add any of the methods listed below, and you can also chain them.
string.SanitizeEmojis()
string.SanitizeLinebreaks()
string.SanitizeUrls()
string.SanitizeExcessiveSpaces()
string.SanitizeLeadingEmptyCharacter()
string.SanitizeNonAlphanumeric()
string.SanitizeNumeric()
string.SanitizeCreditCard()
string.SanitizeEndingEmptyCharacter()
and an example of chaining them:
string.SanitizeEmojis().SanitizeUrls().SanitizeExcessiveSpaces()
You can also take advantage of toString()
and then use any of these methods, if you wish to. Eg:
number.toString().SanitizeNumeric()
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.3 is compatible. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.5
- No dependencies.
-
.NETStandard 1.3
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Stax.StringSanitizer:
Package | Downloads |
---|---|
Stax.StringToUrl
Extension method to convert any string into a dash seperated string to be used for a URL. Eg: hello world is turned into hello-world. Non alpha numeric characters are stripped and diacritics are removed too. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 4,293 | 4/17/2022 |
Initial release. Adds the features:
* Remove emojis from a string
* Remove linebreaks from a string
* Remove URLs from a string
* Remove excessive spaces from a string (more than one occurrence of a space)
* Remove leading character if it is empty
* Remove ending character if it is empty
* Remove any non alphanumeric characters (with the option to disable/enable removing whitespaces too)
* Remove any numeric characters from a string (with the option to disable/enable removing whitespaces too)
* Remove credit cards from a string