String

extension String
  • Check if the provided string is a number representation

    E.g. 1234 -> true 1234.5678 -> true 0 -> true 0.0 -> true x50 -> false .1 -> true Any word/char -> false

    Declaration

    Swift

    public var isNumerical: Bool { get }
  • Check if the provided string holds only digits [0-9]

    E.g. 1234 -> true 1234.5678 -> false 0 -> true 0.0 -> false x50 -> false .1 -> false Any word/char -> false

    Declaration

    Swift

    public var isDigitsOnly: Bool { get }
  • NSRange with full range of self

    Declaration

    Swift

    public var fullRange: NSRange { get }
  • Find the first group in the matching suffix string and return that substring in group.

    Declaration

    Swift

    @available(*, deprecated)
    public func hasSuffix(pattern: String = "\\[(\\d*)\\]") -> String?
  • Returns the nth found group by the pattern matched as a string.

    Declaration

    Swift

    public func match(pattern: String, group number: Int = 1) -> String?
  • File reading/handling error cases

    See more

    Declaration

    Swift

    public enum FileReaderError : Error
  • Read the contents of a local file at path self.

    Throws

    FileReaderError when File not exists | An error in the Cocoa domain, if url cannot be read.

    Declaration

    Swift

    public func readFileContents() throws -> Data

    Return Value

    Data with contents of the File at path self

  • Returns path as URL

    Declaration

    Swift

    public var asURL: URL { get }