github.com/isyscore/isc-gobase@v1.5.3-0.20231218061332-cbc7451899e9/isc/test/utf8string_test.go (about)

     1  package test
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/isyscore/isc-gobase/isc"
     7  )
     8  
     9  func TestUTF8String(t *testing.T) {
    10  	var s = ISCUTF8String("指令集UTF8字符串")
    11  
    12  	t.Logf("len = %d\n", s.Length())
    13  	idx := s.IndexOf(ISCUTF8String("集")) // 2
    14  	t.Logf("indexOf(\"集\") = %d\n", idx)
    15  
    16  	ss := s.Insert(3, ISCUTF8String("xyz"))
    17  	t.Logf("%v\n", ss) // 指令集xyzUTF8字符串
    18  
    19  	sss := ss.Delete(3, 3)
    20  	t.Logf("%v\n", sss) // 指令集UTF8字符串
    21  
    22  }