26 lines
460 B
Go
26 lines
460 B
Go
package at
|
|
|
|
type Resp string
|
|
|
|
const RespNil = Resp("")
|
|
|
|
func (resp Resp) Check() bool {
|
|
return len(resp) >= 2 && resp[len(resp)-2:] == "OK"
|
|
}
|
|
|
|
func (resp Resp) RmFront(str string) Resp {
|
|
return Resp(string(resp)[len(str):])
|
|
}
|
|
|
|
func (resp Resp) CheckFront(str string) bool {
|
|
return len(resp) >= len(str) && resp[:len(str)].String() == str
|
|
}
|
|
|
|
func (resp Resp) String() string {
|
|
return string(resp)
|
|
}
|
|
|
|
func (resp Resp) Bytes() []byte {
|
|
return []byte(resp)
|
|
}
|