mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-06 18:28:00 -05:00
37 lines
767 B
Go
37 lines
767 B
Go
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)))
|
|
}
|