Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

字符串池化缓存示例

示例:

import stdx.string_intern.Internable

main(): Unit {
    String.configInternPool(capacity: 10000, strMaxLength: 1000)
    let intern1 = String.intern("hello, 仓颉")
    println(intern1)
    let intern2 = String.intern(unsafe { "hello, 仓颉".rawData() })
    println(intern2)
}

运行结果:

hello, 仓颉
hello, 仓颉