simplify stringlist

This commit is contained in:
v2ray
2016-01-15 15:23:12 +01:00
parent a403859105
commit 2d233295e6
14 changed files with 120 additions and 143 deletions
+20
View File
@@ -1,5 +1,9 @@
package serial
import (
"strings"
)
// An interface for any objects that has string presentation.
type String interface {
String() string
@@ -7,6 +11,22 @@ type String interface {
type StringLiteral string
func NewStringLiteral(str String) StringLiteral {
return StringLiteral(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)))
}