Lint
This commit is contained in:
parent
2abd2576ce
commit
09d21e835b
|
@ -19,7 +19,9 @@ open class StringUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
// memoised padding up to 10
|
// memoised padding up to 10
|
||||||
fileprivate static var padding: [String] = ["", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "]
|
fileprivate static let padding: [String] = ["", " ", " ", " ", " ", " ", " ", " ", " ", " ", " "]
|
||||||
|
private static let empty = ""
|
||||||
|
private static let space = " "
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join a collection of strings by a seperator
|
* Join a collection of strings by a seperator
|
||||||
|
@ -66,20 +68,15 @@ open class StringUtil {
|
||||||
*/
|
*/
|
||||||
open static func padding(_ width: Int) -> String {
|
open static func padding(_ width: Int) -> String {
|
||||||
|
|
||||||
if(width <= 0) {
|
if width <= 0 {
|
||||||
return ""
|
return empty
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width < padding.count) {
|
if width < padding.count {
|
||||||
return padding[width]
|
return padding[width]
|
||||||
}
|
}
|
||||||
|
|
||||||
var out: [Character] = [Character]()
|
return String.init(repeating: space, count: width)
|
||||||
|
|
||||||
for _ in 0..<width {
|
|
||||||
out.append(" ")
|
|
||||||
}
|
|
||||||
return String(out)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -231,7 +228,7 @@ open class StringUtil {
|
||||||
|
|
||||||
if(base == nil || base?.scheme == nil) {
|
if(base == nil || base?.scheme == nil) {
|
||||||
let abs = URL(string: relUrl)
|
let abs = URL(string: relUrl)
|
||||||
return abs != nil && abs?.scheme != nil ? abs!.absoluteURL.absoluteString : ""
|
return abs != nil && abs?.scheme != nil ? abs!.absoluteURL.absoluteString : empty
|
||||||
} else {
|
} else {
|
||||||
let url = resolve(base!, relUrl: relUrl)
|
let url = resolve(base!, relUrl: relUrl)
|
||||||
if(url != nil) {
|
if(url != nil) {
|
||||||
|
@ -244,7 +241,7 @@ open class StringUtil {
|
||||||
return ext
|
return ext
|
||||||
}
|
}
|
||||||
|
|
||||||
return ""
|
return empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// try {
|
// try {
|
||||||
|
|
Loading…
Reference in New Issue