Utils
public class Utils
Helpers.
-
Get substring throwing error if out of bounds instead of crashing as the default swift implementation does.
Indices are allowed to be negative to count from the end of the string. “from” has to be in the range from -string.count up to and including string.count-1. “to” has to be in the range from -string.count up to and including string.count.
if “to” is less than or equal to “from” (after applying negative values) empty string is returned.
Declaration
Swift
public static func substring(_ string: String, _ from: Int, _ to: Int) throws -> String
-
Declaration
Swift
public static func substring(_ string: String, _ from: Int) throws -> String
-
Declaration
Swift
public static func substring(_ string: String, _ from: Int, count: Int) throws -> String
-
Declaration
Swift
public static func substring(_ string: String, _ range: NSRange) throws -> String
-
Pad string up to length.
Declaration
Swift
public static func pad(_ string: String, _ length: Int, _ withPad: Character) -> String
-
Declaration
Swift
public static func pad0(_ string: String, _ length: Int) -> String
-
If optional is not nil prints string representation with prefix. For use with describing functions. Returns “name=value” if value is not nil or empty string otherwise. If first is false the name is prepended by a whitespace. This is the default hence you have to use “first: true” only for the first debug print value. Avoids the need to add a whitespace in the name.
Declaration
Swift
public static func debugPrint<T>(_ name: String, _ value: T?, first: Bool = false) -> String
-
Declaration
Swift
public static func debugPrint<T>(_ name: String, _ value: T, first: Bool = false) -> String
-
Declaration
Swift
public static func debugPrint(_ name: String, _ value: String?, first: Bool = false) -> String
-
Declaration
Swift
public static func debugPrint(_ name: String, _ value: String, first: Bool = false) -> String
-
Declaration
Swift
public static func debugPrint<T>(_ name: String, _ value: [T]?, multiline: Bool = false, first: Bool = false) -> String
-
Declaration
Swift
public static func debugPrint<T>(_ name: String, _ value: [T], multiline: Bool = false, first: Bool = false) -> String