parseAnswers check whether specified answer count for question
(query *string)
| 267 | |
| 268 | // parseAnswers check whether specified answer count for question |
| 269 | func (sp *SearchParser) parseAnswers(query *string) (answers int) { |
| 270 | var ( |
| 271 | q = *query |
| 272 | expr = `answers:(\d+)` |
| 273 | ) |
| 274 | answers = -1 |
| 275 | |
| 276 | re := regexp.MustCompile(expr) |
| 277 | res := re.FindStringSubmatch(q) |
| 278 | if len(res) > 1 { |
| 279 | answers = converter.StringToInt(res[1]) |
| 280 | q = re.ReplaceAllString(q, "") |
| 281 | } |
| 282 | |
| 283 | *query = strings.TrimSpace(q) |
| 284 | return |
| 285 | } |
| 286 | |
| 287 | // parseAccepted check the search is limit accepted answer or not |
| 288 | func (sp *SearchParser) parseAccepted(query *string) (accepted bool) { |
no test coverage detected