Skip to content

Commit

Permalink
Merge pull request #113 from bluesuncorp/v5-development
Browse files Browse the repository at this point in the history
update string comparisons to use utf8.RuneCountInString
  • Loading branch information
Dean Karn authored and Dean Karn committed Jul 13, 2015
2 parents 06aac46 + 8a9bd75 commit ac33a23
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions baked_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ func isGte(top interface{}, current interface{}, field interface{}, param string
case reflect.String:
p := asInt(param)

return int64(len(st.String())) >= p
return int64(utf8.RuneCountInString(st.String())) >= p

case reflect.Slice, reflect.Map, reflect.Array:
p := asInt(param)
Expand Down Expand Up @@ -637,7 +637,7 @@ func isGt(top interface{}, current interface{}, field interface{}, param string)
case reflect.String:
p := asInt(param)

return int64(len(st.String())) > p
return int64(utf8.RuneCountInString(st.String())) > p

case reflect.Slice, reflect.Map, reflect.Array:
p := asInt(param)
Expand Down Expand Up @@ -681,7 +681,7 @@ func hasLengthOf(top interface{}, current interface{}, field interface{}, param
case reflect.String:
p := asInt(param)

return int64(len(st.String())) == p
return int64(utf8.RuneCountInString(st.String())) == p

case reflect.Slice, reflect.Map, reflect.Array:
p := asInt(param)
Expand Down Expand Up @@ -875,7 +875,7 @@ func isLte(top interface{}, current interface{}, field interface{}, param string
case reflect.String:
p := asInt(param)

return int64(len(st.String())) <= p
return int64(utf8.RuneCountInString(st.String())) <= p

case reflect.Slice, reflect.Map, reflect.Array:
p := asInt(param)
Expand Down Expand Up @@ -920,7 +920,7 @@ func isLt(top interface{}, current interface{}, field interface{}, param string)
case reflect.String:
p := asInt(param)

return int64(len(st.String())) < p
return int64(utf8.RuneCountInString(st.String())) < p

case reflect.Slice, reflect.Map, reflect.Array:
p := asInt(param)
Expand Down

0 comments on commit ac33a23

Please sign in to comment.