github.com/GeniusesGroup/libgo@v0.0.0-20220929090155-5ff932cb408e/language/string.go (about)

     1  /* For license and copyright information please see LEGAL file in repository */
     2  
     3  package lang
     4  
     5  // Compress use to compress a string array!
     6  func Compress(s []byte) ([]byte, error) { return nil, nil }
     7  
     8  // UnCompress use to un-compress a string array!
     9  func UnCompress(s []byte) ([]byte, error) { return nil, nil }
    10  
    11  // Validate use to validate a string array for any error!
    12  // We don't offer any fix proccess! Any suggestion can have security concern!
    13  func Validate(s []byte) error { return nil }
    14  
    15  // ValidateDeep use to validate a string array for any error deeply!
    16  // We don't offer any fix proccess! Any suggestion can have security concern!
    17  func ValidateDeep(s []byte) error { return nil }
    18  
    19  // EncodeToUTF8 use to encode(convert) this package structure to UTF-8 structure!
    20  func EncodeToUTF8(s []byte) ([]byte, error) { return nil, nil }
    21  
    22  // DecodeFromUTF8 use to decode(convert) UTF-8 structure to this package structure!
    23  func DecodeFromUTF8(s []byte) ([]byte, error) { return nil, nil }
    24  
    25  // DetectScripts use to detect scripts IDs in a string
    26  // It mostly use for compression and un-compression!
    27  func DetectScripts(s []byte) []uint32 { return nil }
    28  
    29  // DecodeCompressCharecter use to decode first charecter and its size in a valid compress string!
    30  func DecodeCompressCharecter(s []byte) (ch [4]byte, size int) {
    31  	var s0 byte = s[0]
    32  	var s1 byte = s[1]
    33  	if s1 < 128 {
    34  		return [4]byte{s0, 128, 128, 128}, 1
    35  	}
    36  	var s2 byte = s[2]
    37  	if s2 < 128 {
    38  		return [4]byte{s0, s1, 128, 128}, 2
    39  	}
    40  	var s3 byte = s[3]
    41  	if s3 < 128 {
    42  		return [4]byte{s0, s1, s2, 128}, 3
    43  	}
    44  	return [4]byte{s0, s1, s2, s3}, 4
    45  }