github.com/zerosnake0/jzon@v0.0.9-0.20230801092939-1b135cb83f7f/struct_field_upper.go (about)

     1  package jzon
     2  
     3  import (
     4  	"unicode"
     5  	"unicode/utf8"
     6  )
     7  
     8  func toUpper(in, out []byte) []byte {
     9  	l := len(in)
    10  	for i := 0; i < l; {
    11  		r, size := utf8.DecodeRune(in[i:])
    12  		fr := unicode.SimpleFold(r)
    13  		for fr > r {
    14  			fr = unicode.SimpleFold(fr)
    15  		}
    16  		out = appendRune(out, fr)
    17  		i += size
    18  	}
    19  	return out
    20  }