mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
767 B
37 lines
767 B
package serial
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// An interface for any objects that has string presentation.
|
|
type String interface {
|
|
String() string
|
|
}
|
|
|
|
type StringLiteral string
|
|
|
|
func NewStringLiteral(str String) StringLiteral {
|
|
return StringLiteral(str.String())
|
|
}
|
|
|
|
func (this StringLiteral) Contains(str String) bool {
|
|
return strings.Contains(this.String(), str.String())
|
|
}
|
|
|
|
func (this StringLiteral) String() string {
|
|
return string(this)
|
|
}
|
|
|
|
func (this StringLiteral) ToLower() StringLiteral {
|
|
return StringLiteral(strings.ToLower(string(this)))
|
|
}
|
|
|
|
func (this StringLiteral) ToUpper() StringLiteral {
|
|
return StringLiteral(strings.ToUpper(string(this)))
|
|
}
|
|
|
|
func (this StringLiteral) TrimSpace() StringLiteral {
|
|
return StringLiteral(strings.TrimSpace(string(this)))
|
|
}
|