Skip to content

Commit

Permalink
fix: edge case prefix04
Browse files Browse the repository at this point in the history
  • Loading branch information
ieow committed Jun 3, 2024
1 parent f20a23b commit 44ad391
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/TorusUtils/Extensions/String+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ extension String {
return hasPrefix("04")
}

func add04Prefix() -> String {
if !hasPrefix("04") {
func add04Prefix(targetLength: Int = 128) -> String {
if !hasPrefix("04") && self.count == targetLength{
return "04" + self
}
return self
}

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

0 comments on commit 44ad391

Please sign in to comment.