From 7e5474c575305a69e22299d1a0373658b66e25c8 Mon Sep 17 00:00:00 2001 From: Mythical Forest Collective Date: Sun, 3 Sep 2023 04:52:43 +0100 Subject: [PATCH] Minor patch for far future proofing --- nulid.nimble | 2 +- src/nulid.nim | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/nulid.nimble b/nulid.nimble index 88fadad..e4aac71 100644 --- a/nulid.nimble +++ b/nulid.nimble @@ -1,6 +1,6 @@ # Package -version = "0.2.0" +version = "0.2.1" author = "Yu Vitaqua fer Chronos" description = "An implementation of ULID!" license = "CC0" diff --git a/src/nulid.nim b/src/nulid.nim index cfdddf6..feae6ca 100644 --- a/src/nulid.nim +++ b/src/nulid.nim @@ -106,4 +106,7 @@ proc parseNulid*(ulidStr: string): NULID = result.randomness = UInt128.decode(ulidStr[10..25]) proc `$`*(ulid: NULID): string = - result = '0' & Int128.encode(ulid.toInt128(), 26) + result = Int128.encode(ulid.toInt128(), 26) + + if result.len < 26: + result.insert("0")