// getNumberFormat will update the parsedNumFmt struct if it has become out of date, since a cell's NumFmt string is a
// public field that could be edited by clients.
424763
func (c *Cell) getNumberFormat() *parsedNumberFormat {
	if c.parsedNumFmt == nil || c.parsedNumFmt.numFmt != c.NumFmt {
		c.parsedNumFmt = parseFullNumberFormatString(c.NumFmt)
	}
	return c.parsedNumFmt
}
1189480
func GetExampleNumberForType(regionCode string, typ PhoneNumberType) *PhoneNumber {
	// Check the region code is valid.
	if !isValidRegionCode(regionCode) {
		return nil
	}
	//PhoneNumberDesc (pointer?)
	var desc = getNumberDescByType(getMetadataForRegion(regionCode), typ)
	exNum := desc.GetExampleNumber()
	if len(exNum) > 0 {
		num, err := Parse(exNum, regionCode)
		if err != nil {
			return nil
		}
		return num
	}
	return nil
}
710777
func getFormatXLInQuorum(formats []*formatXLV3) (*formatXLV3, error) {
	formatHashes := make([]string, len(formats))
	for i, format := range formats {
		if format == nil {
			continue
		}
		h := sha256.New()
		for _, set := range format.XL.Sets {
			for _, diskID := range set {
				h.Write([]byte(diskID))
			}
		}
		formatHashes[i] = hex.EncodeToString(h.Sum(nil))
	}

	formatCountMap := make(map[string]int)
	for _, hash := range formatHashes {
		if hash == "" {
			continue
		}
		formatCountMap[hash]++
	}

	maxHash := ""
	maxCount := 0
	for hash, count := range formatCountMap {
		if count > maxCount {
			maxCount = count
			maxHash = hash
		}
	}

	if maxCount < len(formats)/2 {
		return nil, errXLReadQuorum
	}

	for i, hash := range formatHashes {
		if hash == maxHash {
			format := *formats[i]
			format.XL.This = ""
			return &format, nil
		}
	}

	return nil, errXLReadQuorum
}
246513
func setCustomNumFmt(style *xlsxStyleSheet, formatStyle *formatStyle) int {
	nf := xlsxNumFmt{FormatCode: *formatStyle.CustomNumFmt}
	if style.NumFmts != nil {
		nf.NumFmtID = style.NumFmts.NumFmt[len(style.NumFmts.NumFmt)-1].NumFmtID + 1
		style.NumFmts.NumFmt = append(style.NumFmts.NumFmt, &nf)
		style.NumFmts.Count++
	} else {
		nf.NumFmtID = 164
		numFmts := xlsxNumFmts{
			NumFmt: []*xlsxNumFmt{&nf},
			Count:  1,
		}
		style.NumFmts = &numFmts
	}
	return nf.NumFmtID
}
79755
func FormatNumberDecimal(x decimal.Decimal, precision int, thousand string, decimalStr string) string {
	return formatNumberString(x.StringFixed(int32(precision)), precision, thousand, decimalStr)
}
437883
func (b *block) GetFormat() Format {
	// Verify checksum.
	var p parser
	value := p.parseOctal(b.V7().Chksum())
	chksum1, chksum2 := b.ComputeChecksum()
	if p.err != nil || (value != chksum1 && value != chksum2) {
		return FormatUnknown
	}

	// Guess the magic values.
	magic := string(b.USTAR().Magic())
	version := string(b.USTAR().Version())
	trailer := string(b.STAR().Trailer())
	switch {
	case magic == magicUSTAR && trailer == trailerSTAR:
		return formatSTAR
	case magic == magicUSTAR:
		return FormatUSTAR | FormatPAX
	case magic == magicGNU && version == versionGNU:
		return FormatGNU
	default:
		return formatV7
	}
}
712166
func IsFormat(s string) bool {
	r := []rune(s)
	if len(r) != 2 {
		return false
	}
	switch r[1] {
	case 107, 108, 109, 110, 111, 114:
		return true
	}
	return false
}
757088
func GetFormatter(logger *StreamLogger) LogFormatter {
	return func(w io.Writer, params url.Values, val interface{}) error {
		fmter, ok := val.(Formatter)
		if !ok {
			_, err := fmt.Fprintf(w, "Error: unexpected value of type %T in %s!", val, logger.Name())
			return err
		}
		return fmter.Logf(w, params)
	}
}
1146621
func GetSubFormatInfo(format int) (oformat int, name string, ok bool) {
	var o C.SF_FORMAT_INFO
	o.format = C.int(format)
	ok = (0 == C.sf_command(nil, C.SFC_GET_FORMAT_SUBTYPE, unsafe.Pointer(&o), C.int(unsafe.Sizeof(o))))
	oformat = int(o.format)
	name = C.GoString(o.name)
	return
}
1233136
func FormatNumberBigDecimal(x *apd.Decimal, precision int, thousand string, decimalStr string) string {
	d := apd.New(0, 0)
	apd.BaseContext.WithPrecision(uint32(x.NumDigits()) + uint32(precision)).Quantize(d, x, int32(-precision))
	return formatNumberString(d.Text('f'), precision, thousand, decimalStr)
}
599955
func (p *Project) GetNumber() int {
	if p == nil || p.Number == nil {
		return 0
	}
	return *p.Number
}
776498
func NewErrorformat(efms []string) (*Errorformat, error) {
	errorformat := &Errorformat{Efms: make([]*Efm, 0, len(efms))}
	for _, efm := range efms {
		e, err := NewEfm(efm)
		if err != nil {
			return nil, err
		}
		errorformat.Efms = append(errorformat.Efms, e)
	}
	return errorformat, nil
}
1289684
func (f *Form) GetFormItemIndex(label string) int {
	for index, item := range f.items {
		if item.GetLabel() == label {
			return index
		}
	}
	return -1
}
978597
func (m *Milestone) GetNumber() int {
	if m == nil || m.Number == nil {
		return 0
	}
	return *m.Number
}
331558
func (d *DiscussionComment) GetNumber() int {
	if d == nil || d.Number == nil {
		return 0
	}
	return *d.Number
}
774329
func (e *Emoji) MessageFormat() string {
	if e.ID != "" && e.Name != "" {
		if e.Animated {
			return "<a:" + e.APIName() + ">"
		}

		return "<:" + e.APIName() + ">"
	}

	return e.APIName()
}
467474
func (v *Object) GetNumber(keys ...string) (json.Number, error) {
	child, err := v.getPath(keys)

	if err != nil {
		return "", err
	}
	n, err := child.Number()

	if err != nil {
		return "", err
	}
	return n, nil
}