package pluralimport ()func finvtw( interface{}) (int64, int64, float64, int, int64, int) {// @see http://unicode.org/reports/tr35/tr35-numbers.html#Operands // // Symbol Value // n absolute value of the source number (integer and decimals). // i integer digits of n. // v number of visible fraction digits in n, with trailing zeros. // w number of visible fraction digits in n, without trailing zeros. // f visible fractional digits in n, with trailing zeros. // t visible fractional digits in n, without trailing zeros.varstringvarintvarint64varint64varfloat64varintvarint64switch .(type) {caseint: = int64(.(int))return0, , math.Abs(float64()), 0, 0, 0caseint64: = .(int64)return0, , math.Abs(float64()), 0, 0, 0casefloat64: := .(float64) = strconv.FormatFloat(, 'f', -1, 64) = strings.Index(, ".")if -1 == {return0, int64(), math.Abs(), 0, 0, 0 } = math.Abs()casestring: = .(string) = strings.Index(, ".")if -1 == { , := strconv.ParseInt(, 10, 64)ifnil != {return0, 0, 0, 0, 0, 0 }return0, , math.Abs(float64()), 0, 0, 0 } , := strconv.ParseFloat(, 64)ifnil != {return0, 0, 0, 0, 0, 0 } = math.Abs() } := [+1:] , := strconv.ParseInt(, 10, 64)ifnil != {return0, 0, 0, 0, 0, 0 } , = strconv.ParseInt([:], 10, 64)ifnil != {return0, 0, 0, 0, 0, 0 } = len()varstring := len():for := - 1; >= 0; -- {switch [] {case'0': --default:break } }if >= 1 { = [:] }if"" == {return , , , , 0, 0 } elseif != { , = strconv.ParseInt(, 10, 64)ifnil != {return0, 0, 0, 0, 0, 0 }return , , , , , len() }return , , , , , }
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.