SourceExpress.ShorterGuid
1.0.1
See the version list below for details.
dotnet add package SourceExpress.ShorterGuid --version 1.0.1
NuGet\Install-Package SourceExpress.ShorterGuid -Version 1.0.1
<PackageReference Include="SourceExpress.ShorterGuid" Version="1.0.1" />
paket add SourceExpress.ShorterGuid --version 1.0.1
#r "nuget: SourceExpress.ShorterGuid, 1.0.1"
// Install SourceExpress.ShorterGuid as a Cake Addin #addin nuget:?package=SourceExpress.ShorterGuid&version=1.0.1 // Install SourceExpress.ShorterGuid as a Cake Tool #tool nuget:?package=SourceExpress.ShorterGuid&version=1.0.1
SourceExpress.ShorterGuid
This library contains extension methods ToShorterString()
for Guid
and FromShorterString()
for String
. It generates a 26 character string from the Guid, which is URL-safe and case-insensitive!
Inspired by CSharpVitamins.ShortGuid which uses Base64 encoding and produces 22-character string, however this library uses Base32-ish encoding, and only uses the following character set: 012345abcdefghijklmnopqrstuvwxyz
.
Available on NuGet. To install, run the following command in the Package Manager Console:
PM> Install-Package SourceExpress.ShorterGuid
The Gist
It takes a standard guid like this:
b392ebf5-88d3-49b9-9ad8-1d4a73431787
and shortens it to a smaller string like this:
yrpt5gynl2wonaqs3p5baksrkw
Using the ShorterGuid
The ShorterGuid
provides an extension method for Guid
class:
var guid = Guid.NewGuid(); // b392ebf5-88d3-49b9-9ad8-1d4a73431787
var shorterGuid = guid.ToShorterString(); // yrpt5gynl2wonaqs3p5baksrkw
If you need to get Guid
from the ShorterGuid string
, you can do that using second extension method:
var shorterGuid = "yrpt5gynl2wonaqs3p5baksrkw";
var guid = shorterGuid.FromShorterString(); // b392ebf5-88d3-49b9-9ad8-1d4a73431787
Methods contain some internal error handling like wrong character or incorrect length of the ShorterGuid
. See test project for more details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net6.0
- No dependencies.
-
net7.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.
- 1.0.1 Fixed nuget configuration
- 1.0.0 Initial release.