MCPcopy Create free account
hub / github.com/dop251/goja / Substring

Method Substring

string_unicode.go:477–492  ·  view source on GitHub ↗
(start, end int)

Source from the content-addressed store, hash-verified

475}
476
477func (s unicodeString) Substring(start, end int) String {
478 ss := s[start+1 : end+1]
479 for _, c := range ss {
480 if c >= utf8.RuneSelf {
481 b := make(unicodeString, end-start+1)
482 b[0] = unistring.BOM
483 copy(b[1:], ss)
484 return b
485 }
486 }
487 as := make([]byte, end-start)
488 for i, c := range ss {
489 as[i] = byte(c)
490 }
491 return asciiString(as)
492}
493
494func (s unicodeString) String() string {
495 return string(utf16.Decode(s[1:]))

Callers

nothing calls this directly

Calls 1

asciiStringTypeAlias · 0.85

Tested by

no test coverage detected