StringExtensionsNetStdIeb 1.2.0
See the version list below for details.
dotnet add package StringExtensionsNetStdIeb --version 1.2.0
NuGet\Install-Package StringExtensionsNetStdIeb -Version 1.2.0
<PackageReference Include="StringExtensionsNetStdIeb" Version="1.2.0" />
paket add StringExtensionsNetStdIeb --version 1.2.0
#r "nuget: StringExtensionsNetStdIeb, 1.2.0"
// Install StringExtensionsNetStdIeb as a Cake Addin #addin nuget:?package=StringExtensionsNetStdIeb&version=1.2.0 // Install StringExtensionsNetStdIeb as a Cake Tool #tool nuget:?package=StringExtensionsNetStdIeb&version=1.2.0
String_Extensions
A big pile of string manipulation methods for C#, to fill in some of the gaps of the default string library.
Comparison
CompareWildcard
Match strings to patterns using *
and ?
placeholders. For when Regex is too much.
NaturalComparer
A comparer for use in Linq Sort(...)
that respects numerical ordering.
You can drop this anywhere an IComparer is used on strings. To sort files by name with numbers in the right place:
new DirectoryInfo(@"C:\temp").GetFiles().Select(f=>f.Name).ToList().Sort(new NaturalComparer());
Then, given these files (as ordered by default .Net sort)
File 10, File 11, File 8, File 9
Will be sorted correctly, as would be expected:
File 8, File 9, File 10, File 11
EqualsIgnoreNumbers
Compare strings for equality, ignoring the actual values of decimal numbers
NaturalComparer.EqualsIgnoreNumbers("Added ID 5 to DB","Added ID 201 to DB")
== true
NaturalComparer.EqualsIgnoreNumbers("Added ID 5 to DB","ID 201 Failed")
== false
Parsing
ToByteArray
Convert hex strings to byte arrays.
Take a string like BADF00BA
into a byte array. String length should be a multiple of two.
Replacement
ReplaceCaseInvariant
Replace string fragments using a case-insensitive search.
Matching is case invariant, replacement is done preserving case.
For example: "OnCe UpOn A tImE".ReplaceCaseInvariant("TiMe", "Moon") == "OnCe UpOn A Moon"
ReplaceAsciiCompatible
Replace latin-like letters and numbers with their ASCII equivalents.
This will replace accented forms with ones that look similar, but it will often destroy or change meaning. Do NOT use this to present output to users. It is intended to use for stored search targets. This is not exhaustive, and does not handle characters that are not latin-like (e.g. CJK)
HÉLLO, Åbjørn!".ReplaceAsciiCompatible() == "HELLO, Abjorn!"
Switch case simple
Fast case switching on strings that only makes changes that don't change the number of characters in the string.
"123 £%$: AAA aaa lj dž ß".ToUpperSimple() == "123 £%$: AAA AAA LJ DŽ ß"
"123 £%$: AAA aaa LJ DŽ SS".ToLowerSimple() == "123 £%$: aaa aaa lj dž ss"
Searching
FindCluster
A very simple O(n+m) algorithm for finding clusters of characters in a string.
(i.e. it will find wxyz
in abc zwyx abc
, but not in ab xy ab wz
)
This algorithm will give some false positives where the sum of character values match.
Substrings
A range of substring before/after first/last instances of a character or string.
SubstringBefore, SubstringBeforeLast, SubstringAfter, ExtendedIndexOf, SubstringAfterLast
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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.0 is compatible. netstandard1.1 was computed. netstandard1.2 was computed. netstandard1.3 was computed. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 was computed. netstandard2.1 was computed. |
.NET Framework | net45 was computed. 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. |
Windows Phone | wp8 was computed. wp81 was computed. wpa81 was computed. |
Windows Store | netcore was computed. netcore45 was computed. netcore451 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 1.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Fix for SubstringAfterLast(str)