binary search in memory */
| 231 | |
| 232 | /* binary search in memory */ |
| 233 | int AfString::indexOf(const char *hay, int haysize, const char *needle, int needlesize) |
| 234 | { |
| 235 | int haypos, needlepos; |
| 236 | haysize -= needlesize; |
| 237 | |
| 238 | for (haypos = 0; haypos <= haysize; haypos++) { |
| 239 | for (needlepos = 0; needlepos < needlesize; needlepos++) { |
| 240 | if (hay[haypos + needlepos] != needle[needlepos]) { |
| 241 | // Next character in haystack. |
| 242 | break; |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | if (needlepos == needlesize) { |
| 247 | return haypos; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | return -1; |
| 252 | } |
| 253 | |
| 254 | std::map<std::string, std::string> AfString::keyValueToMap(const std::string &source, const std::string &splitStr) |
| 255 | { |
no outgoing calls
no test coverage detected