📄 string-bundle.zc
字号:
///////////////////////////////////////////////////////////////////////////////
// string-bundle
///////////////////////////////////////////////////////////////////////////////
import "base/types"
import "base/memory"
import "text/string"
import "memory-bundle"
//-----------------------------------------------------------------------------
// Construct a string from a raw buffer
//-----------------------------------------------------------------------------
public func new string (bundle: memory bundle, s: string)
def len = size (s) + 1
def buf = allocate (bundle, len):string
copy (buf:mem, s:mem, len)
return buf
end
//-----------------------------------------------------------------------------
// Construct a string from a raw buffer
//-----------------------------------------------------------------------------
public func new string (bundle: memory bundle, s: string, len: dword)
def buf = allocate (bundle, len+1):string
copy (buf:mem, s:mem, len)
buf[len] = \0
return buf
end
//-----------------------------------------------------------------------------
// Reserve space for a string
//-----------------------------------------------------------------------------
public func new string (bundle: memory bundle, len: dword)
return allocate (bundle, len+1):string
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -