Skip to content

Commit c461a07

Browse files
committed
fewer lines
1 parent be730e9 commit c461a07

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

public/data/cpp.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@
2121
"code": [
2222
"std::vector<std::string> split_string(std::string str, std::string delim) {",
2323
" std::vector<std::string> splits;",
24-
" int i = 0;",
25-
" int j = str.find(delim);",
24+
" int i = 0, j;",
2625
" int inc = delim.length();",
2726
" while (j != std::string::npos) {",
27+
" j = str.find(delim, i);",
2828
" splits.push_back(str.substr(i, j - i));",
2929
" i = j + inc;",
30-
" j = str.find(delim, i);",
3130
" }",
32-
" splits.push_back(str.substr(i));",
3331
" return splits;",
3432
"}"
3533
],

0 commit comments

Comments
 (0)