ParserUtils

public enum ParserUtils

Helper methods for parsing a ledger file

  • Parses an string into an Decimal

    Declaration

    Swift

    public static func parseAmountDecimalFrom(string: String) -> (Decimal, Int)

    Parameters

    string

    string with the amount

    Return Value

    Tuple with the decimal ane the number of decimal palces the string contained

  • Returns the matches of a NSRegularExpression on a string

    Declaration

    Swift

    public static func match(regex: NSRegularExpression, in string: String) -> [[String]]

    Parameters

    regex

    NSRegularExpression to match

    string

    String to match in

    Return Value

    [[String]], the outer array contains an entry for each match and the inner arrays contain an entry for each capturing group