Documentation ¶
Index ¶
Constants ¶
const ( // Character constants Asterisk = "*" At = "@" BackSlash = "\\" BlockDelimiter = ";" BracketClose = "]" BracketOpen = "[" Colon = ":" Comma = "," Dash = "-" Dollar = "$" Dot = "." Hash = "#" ParenClose = ")" ParenOpen = "(" Percent = "%" Plus = "+" Question = "?" QuoteDouble = "\"" QuoteSingle = "'" Slash = "/" Underscore = "_" Whitespace = " " Zero = "0" // DatesTimesCodeChars defined dates and times control codes in upper case DatesTimesCodeChars = "AEYMDHSG" // NumCodeChars defined numeric code character NumCodeChars = "0123456789" // Token section types TokenSectionNegative = "Negative" TokenSectionPositive = "Positive" TokenSectionText = "Text" TokenSectionZero = "Zero" // Token subtypes TokenSubTypeCurrencyString = "CurrencyString" TokenSubTypeLanguageInfo = "LanguageInfo" TokenTypeColor = "Color" // Token types TokenTypeAlignment = "Alignment" TokenTypeCondition = "Condition" TokenTypeCurrencyLanguage = "CurrencyLanguage" TokenTypeDateTimes = "DateTimes" TokenTypeDecimalPoint = "DecimalPoint" TokenTypeDenominator = "Denominator" TokenTypeDigitalPlaceHolder = "DigitalPlaceHolder" TokenTypeElapsedDateTimes = "ElapsedDateTimes" TokenTypeExponential = "Exponential" TokenTypeFraction = "Fraction" TokenTypeGeneral = "General" TokenTypeHashPlaceHolder = "HashPlaceHolder" TokenTypeLiteral = "Literal" TokenTypeOperand = "Operand" TokenTypeOperator = "Operator" TokenTypePercent = "Percent" TokenTypeRepeatsChar = "RepeatsChar" TokenTypeSwitchArgument = "SwitchArgument" TokenTypeTextPlaceHolder = "TextPlaceHolder" TokenTypeThousandsSeparator = "ThousandsSeparator" TokenTypeUnknown = "Unknown" TokenTypeZeroPlaceHolder = "ZeroPlaceHolder" )
Asterisk, At and other's constants are token definitions.
Variables ¶
var AmPm = []string{"AM/PM", "A/P", "上午/下午"}
AmPm defined the AM and PM with international considerations.
var ColorNames = []string{
"black",
"blue",
"cyan",
"green",
"magenta",
"red",
"white",
"yellow",
}
ColorNames defined colors name used in for a section of the format, use the name of one of the following eight colors in square brackets in the section. The color code shall be the first item in the section.
var ConditionOperators = []string{"<", "<=", ">", ">=", "<>", "="}
ConditionOperators defined the condition operators.
var GeneralFormattingSwitchArguments = []string{
"AIUEO",
"ALPHABETIC",
"alphabetic",
"Arabic",
"ARABICABJAD",
"ARABICALPHA",
"ArabicDash",
"BAHTTEXT",
"CardText",
"CHINESENUM1",
"CHINESENUM2",
"CHINESENUM3",
"CHOSUNG",
"CIRCLENUM",
"DBCHAR",
"DBNUM1",
"DBNUM2",
"DBNUM3",
"DBNUM4",
"DollarText",
"GANADA",
"GB1",
"GB2",
"GB3",
"GB4",
"HEBREW1",
"HEBREW2",
"Hex",
"HINDIARABIC",
"HINDICARDTEXT",
"HINDILETTER1",
"HINDILETTER2",
"IROHA",
"KANJINUM1",
"KANJINUM2",
"KANJINUM3",
"Ordinal",
"OrdText",
"Roman",
"roman",
"SBCHAR",
"THAIARABIC",
"THAICARDTEXT",
"THAILETTER",
"VIETCARDTEXT",
"ZODIAC1",
"ZODIAC2",
"ZODIAC3",
}
GeneralFormattingSwitchArguments defined switch-arguments apply to fields whose field result is a numeric value. If the result type of the field is not numeric, then these switches have no effect.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser struct { InBracket bool InString bool InPlaceholder bool NumFmt string // Runes is a copy of the number format string as a rune slice. It's stored here to avoid // allocating a new slice every time we need to access it. Runes []rune Offset int Tokens Tokens Token Token }
Parser inheritable container.
func NumberFormatParser ¶
func NumberFormatParser() Parser
NumberFormatParser provides function to parse an Excel number format into a stream of tokens.
func (*Parser) PrettyPrint ¶
PrettyPrint provides function to pretty the parsed result with the indented format.
type Section ¶
Section directly maps sections of the number format. Up to four sections of format codes can be specified. The format codes, separated by semicolons, define the formats for positive numbers, negative numbers, zero values, and text, in that order. If only two sections are specified, the first is used for positive numbers and zeros, and the second is used for negative numbers. If only one section is specified, it is used for all numbers. To skip a section, the ending semicolon for that section shall be written.