| 2334 | } |
| 2335 | |
| 2336 | func stringLessInsensitive(a, b string) bool { |
| 2337 | for i := 0; i < len(a) && i < len(b); i++ { |
| 2338 | if a[i] >= 'A' && a[i] <= 'Z' { |
| 2339 | if b[i] >= 'A' && b[i] <= 'Z' { |
| 2340 | // both are uppercase, do nothing |
| 2341 | if a[i] < b[i] { |
| 2342 | return true |
| 2343 | } else if a[i] > b[i] { |
| 2344 | return false |
| 2345 | } |
| 2346 | } else { |
| 2347 | // a is uppercase, convert a to lowercase |
| 2348 | if a[i]+32 < b[i] { |
| 2349 | return true |
| 2350 | } else if a[i]+32 > b[i] { |
| 2351 | return false |
| 2352 | } |
| 2353 | } |
| 2354 | } else if b[i] >= 'A' && b[i] <= 'Z' { |
| 2355 | // b is uppercase, convert b to lowercase |
| 2356 | if a[i] < b[i]+32 { |
| 2357 | return true |
| 2358 | } else if a[i] > b[i]+32 { |
| 2359 | return false |
| 2360 | } |
| 2361 | } else { |
| 2362 | // neither are uppercase |
| 2363 | if a[i] < b[i] { |
| 2364 | return true |
| 2365 | } else if a[i] > b[i] { |
| 2366 | return false |
| 2367 | } |
| 2368 | } |
| 2369 | } |
| 2370 | return len(a) < len(b) |
| 2371 | } |
| 2372 | |
| 2373 | // parseAny parses the next value from a json string. |
| 2374 | // A Result is returned when the hit param is set. |