Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
eba54290
"include/vscode:/vscode.git/clone" did not exist on "f30dbe8717177da2b1745ac3b2a5d5fd7475de55"
Commit
eba54290
authored
Oct 27, 2016
by
Guolin Ke
Browse files
fix bug in string.split()
parent
804d3ada
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
include/LightGBM/utils/common.h
include/LightGBM/utils/common.h
+9
-5
No files found.
include/LightGBM/utils/common.h
View file @
eba54290
...
...
@@ -44,13 +44,17 @@ inline static std::string& RemoveQuotationSymbol(std::string& str) {
return
str
;
}
inline
static
std
::
vector
<
std
::
string
>
Split
(
const
char
*
str
,
char
delimiter
)
{
std
::
stringstream
ss
(
str
);
std
::
string
tmp_str
;
inline
static
std
::
vector
<
std
::
string
>
Split
(
const
char
*
c_str
,
char
delimiter
)
{
std
::
vector
<
std
::
string
>
ret
;
while
(
std
::
getline
(
ss
,
tmp_str
,
delimiter
))
{
ret
.
push_back
(
tmp_str
);
}
std
::
string
str
(
c_str
);
size_t
i
=
0
;
size_t
pos
=
str
.
find
(
delimiter
);
while
(
pos
!=
std
::
string
::
npos
)
{
ret
.
push_back
(
str
.
substr
(
i
,
pos
-
i
));
i
=
++
pos
;
pos
=
str
.
find
(
delimiter
,
pos
);
}
ret
.
push_back
(
str
.
substr
(
i
));
return
ret
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment