Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type StringStack ¶
type StringStack struct {
// contains filtered or unexported fields
}
StringStarck 是一个模拟的字符串栈,提供了入栈出栈等操作
func (*StringStack) Pop ¶
func (s *StringStack) Pop() (string, error)
Pop 将当前栈中的所有数据出栈,并清空当前栈 return
string: 栈中存储的字符串 error: 出栈失败的错误
func (*StringStack) Push ¶
func (s *StringStack) Push(data string) (int, error)
Push 将一个字符串入栈 param
data: 准备入栈的字符串
return
int: 成功入栈后返回入栈的字符串长度 error: 入栈失败返回错误
func (*StringStack) PushByte ¶
func (s *StringStack) PushByte(data byte) (int, error)
PushByte 将一个字节入栈 param
data: 准备入栈的字节
return
int: 成功入栈后返回入栈的字节长度 error: 入栈失败返回错误
type Template ¶
type Template struct { }
func NewTemplate ¶
func NewTemplate() *Template
NewTemplate 解析模板,若模板内容中定义的参数多于实际提供的参数,则未提供的参数不会解析
示例1:
args := make(map[string]string) args["url"] = "http://www.baidu.com" tmpl := "{url }/aa/bb" result := core.NewTemplate().Parse(tmpl, args)
结果1:http://www.baidu.com/aa/bb
示例2:
args := make(map[string]string) args["url"] = "http://www.sina.com" tmpl := "{url }/11/{test}" result := core.NewTemplate().Parse(tmpl, args)
Click to show internal directories.
Click to hide internal directories.