We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent be730e9 commit c461a07Copy full SHA for c461a07
public/data/cpp.json
@@ -21,15 +21,13 @@
21
"code": [
22
"std::vector<std::string> split_string(std::string str, std::string delim) {",
23
" std::vector<std::string> splits;",
24
- " int i = 0;",
25
- " int j = str.find(delim);",
+ " int i = 0, j;",
26
" int inc = delim.length();",
27
" while (j != std::string::npos) {",
+ " j = str.find(delim, i);",
28
" splits.push_back(str.substr(i, j - i));",
29
" i = j + inc;",
30
- " j = str.find(delim, i);",
31
" }",
32
- " splits.push_back(str.substr(i));",
33
" return splits;",
34
"}"
35
],
0 commit comments