mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-03 07:56:42 -05:00
37 lines
677 B
Go
37 lines
677 B
Go
package serial
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// An interface for any objects that has string presentation.
|
|
type String interface {
|
|
String() string
|
|
}
|
|
|
|
type StringT string
|
|
|
|
func NewStringT(str String) StringT {
|
|
return StringT(str.String())
|
|
}
|
|
|
|
func (this StringT) Contains(str String) bool {
|
|
return strings.Contains(this.String(), str.String())
|
|
}
|
|
|
|
func (this StringT) String() string {
|
|
return string(this)
|
|
}
|
|
|
|
func (this StringT) ToLower() StringT {
|
|
return StringT(strings.ToLower(string(this)))
|
|
}
|
|
|
|
func (this StringT) ToUpper() StringT {
|
|
return StringT(strings.ToUpper(string(this)))
|
|
}
|
|
|
|
func (this StringT) TrimSpace() StringT {
|
|
return StringT(strings.TrimSpace(string(this)))
|
|
}
|