Fixed RmFront panic.

This commit is contained in:
Andrey Egorov
2024-08-09 11:21:02 +03:00
parent 6c110b9a8b
commit dde1411b18
3 changed files with 12 additions and 5 deletions

View File

@ -9,12 +9,13 @@ func (resp Resp) Check() bool {
}
func (resp Resp) RmFront(str string) Resp {
if !resp.Check() {
return RespNil
}
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)
}