FolkerKinzel.Strings 1.2.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package FolkerKinzel.Strings --version 1.2.0
NuGet\Install-Package FolkerKinzel.Strings -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FolkerKinzel.Strings" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FolkerKinzel.Strings --version 1.2.0
#r "nuget: FolkerKinzel.Strings, 1.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FolkerKinzel.Strings as a Cake Addin
#addin nuget:?package=FolkerKinzel.Strings&version=1.2.0

// Install FolkerKinzel.Strings as a Cake Tool
#tool nuget:?package=FolkerKinzel.Strings&version=1.2.0

FolkerKinzel.Strings

.NET library, containing extension methods for String, StringBuilder and ReadOnlySpan<Char>.

Content:

  • Extension methods which return an equal (and therefore persistable) Int32 hashcode for an identical Char sequence everytime they are called - even on String, StringBuilder or ReadOnlySpan<Char>. The hashcodes can be specified to hash the sequence ordinal, ordinal case insensitive or alphanumeric case insensitive. The hashcodes produced by this library are not equivalent to the hashcodes produced by the .NET-Framework 4.0 System.String class, because they use roundshifting to keep more information. Don't use these hashcodes for security critical purposes (such as hashing passwords)!

Example:

using System;
using System.Text;
using FolkerKinzel.Strings;

namespace Examples
{
  public static class ShortExample
  {
    public static void CreateConstantStringHashes()
    {
       Console.WriteLine("Ordinal:");
       const string s1 = "Hello Folker!";
       Console.WriteLine(
         $"{s1.GetStableHashCode(HashType.Ordinal),10:X08}");
       Console.WriteLine(
         $"{new StringBuilder().Append(s1).GetStableHashCode(HashType.Ordinal),10:X08}");
       Console.WriteLine("OrdinalIgnoreCase:");
       Console.WriteLine(
         $"{"HELLO FOLKER!".GetStableHashCode(HashType.Ordinal),10:X08}");
       Console.WriteLine(
         $"{"Hello Folker!".AsSpan().GetStableHashCode(HashType.OrdinalIgnoreCase),10:X08}");
       Console.WriteLine("AlphaNumericIgnoreCase:");
       Console.WriteLine(
         $"{"HELLO FOLKER!".AsSpan().GetStableHashCode(HashType.AlphaNumericIgnoreCase),10:X08}");
       Console.WriteLine(
         $"{new StringBuilder().Append("&: !heL##Lof OLker *").GetStableHashCode(HashType.AlphaNumericIgnoreCase),10:X08}");

       // Different HashTypes may produce different hashcodes on the same Char sequence
       // and must therefore not be mixed:
       Console.WriteLine("Same String - different HashTypes:");
       Console.WriteLine(
          $"{s1.GetStableHashCode(HashType.Ordinal),10:X08}");
       Console.WriteLine(
         $"{s1.GetStableHashCode(HashType.OrdinalIgnoreCase),10:X08}");
       Console.WriteLine(
         $"{s1.GetStableHashCode(HashType.AlphaNumericIgnoreCase),10:X08}");
   }
 }
}
/*
Output:

Ordinal:
  A31FA6EC
  A31FA6EC
OrdinalIgnoreCase:
  1BBFB34C
  1BBFB34C
AlphaNumericIgnoreCase:
  C672C38C
  C672C38C
Same String - different HashTypes:
  A31FA6EC
  1BBFB34C
  C672C38C
*/
Product 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 netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net40 is compatible.  net403 was computed.  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 tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.0

    • No dependencies.
  • .NETFramework 4.5

  • .NETStandard 2.0

  • .NETStandard 2.1

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on FolkerKinzel.Strings:

Package Downloads
FolkerKinzel.MimeTypes The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

.NET Library that supports working with Internet Media Types ("MIME Types")

FolkerKinzel.CsvTools The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

.NET library to read and write CSV files.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.0-beta.1 34 4/28/2024
7.3.0 418 4/10/2024
7.2.0 675 11/26/2023
7.1.1 2,282 11/5/2023
7.1.0 177 10/27/2023
7.0.1 968 10/18/2023
7.0.0 273 9/24/2023
6.4.0 196 9/23/2023
6.3.0 147 9/21/2023
6.2.0 160 9/19/2023
6.1.0 140 9/17/2023
6.0.0 121 9/10/2023
5.3.1 178 8/24/2023
5.3.0 381 7/22/2023
5.2.0 208 7/15/2023
5.1.0 236 7/10/2023
5.0.0 242 7/1/2023
4.4.0 47,909 1/21/2022
4.3.0 522 1/20/2022
4.2.0 520 1/15/2022
4.1.0 3,667 12/24/2021
4.0.0 377 12/12/2021
3.3.0 1,442 10/27/2021
3.2.0 438 9/5/2021
3.2.0-beta.1 163 8/25/2021
3.1.0 393 8/11/2021
3.1.0-beta.1 155 8/9/2021
3.0.0 437 8/6/2021
3.0.0-beta.2 163 8/4/2021
3.0.0-beta 279 7/27/2021
2.0.0 442 6/30/2021
1.2.0 452 2/13/2021
1.1.0 642 7/5/2020

Adds support for Netstandard 2.0 and .NET-Framework 4.5.
     
     The extension method GetStableHashCode is now available also on ReadOnlySpan<char> on all supported platforms except .NET Framework 4.0.

     The enum value HashType.AlphaNumericNoCase is now marked as obsolete and has a replacement in HashType.AlphaNumericIgnoreCase.