Skip to content

Commit 608c284

Browse files
authored
Merge pull request #98 from torusresearch/fix/edgecase-prefix04
fix: edge case prefix04
2 parents f20a23b + b4c43a1 commit 608c284

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Sources/TorusUtils/Extensions/String+Extension.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ extension String {
2424
return hasPrefix("04")
2525
}
2626

27-
func add04Prefix() -> String {
28-
if !hasPrefix("04") {
27+
func add04Prefix(targetLength: Int = 128) -> String {
28+
if self.count == targetLength{
2929
return "04" + self
3030
}
3131
return self
3232
}
3333

34-
func strip04Prefix() -> String {
35-
if hasPrefix("04") {
34+
func strip04Prefix(targetLength: Int = 130) -> String {
35+
if hasPrefix("04") && self.count == targetLength {
3636
let indexStart = index(startIndex, offsetBy: 2)
3737
return String(self[indexStart...])
3838
}

Torus-utils.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = "Torus-utils"
3-
spec.version = "8.1.0"
3+
spec.version = "8.1.2"
44
spec.ios.deployment_target = "13.0"
55
spec.summary = "Retrieve user shares"
66
spec.homepage = "https://github.com/torusresearch/torus-utils-swift"

0 commit comments

Comments
 (0)