Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
934be047
Commit
934be047
authored
Nov 25, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X move strings -> pygolang (there was a bug an implementation needed tests)
parent
df371d3f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
68 deletions
+0
-68
wcfs/internal/wcfs_misc.cpp
wcfs/internal/wcfs_misc.cpp
+0
-51
wcfs/internal/wcfs_misc.h
wcfs/internal/wcfs_misc.h
+0
-17
No files found.
wcfs/internal/wcfs_misc.cpp
View file @
934be047
...
...
@@ -163,57 +163,6 @@ error map_into(void *addr, size_t size, int prot, int flags, const os::File f, o
}
// mm::
// strings::
namespace
strings
{
bool
has_prefix
(
const
string
&
s
,
const
string
&
prefix
)
{
return
s
.
compare
(
0
,
prefix
.
size
(),
prefix
)
==
0
;
// XXX -> pygolang + tests
}
bool
has_prefix
(
const
string
&
s
,
char
prefix
)
{
return
(
s
.
size
()
>=
1
&&
s
[
0
]
==
prefix
);
}
bool
has_suffix
(
const
string
&
s
,
const
string
&
suffix
)
{
return
(
s
.
size
()
>=
suffix
.
size
()
&&
s
.
compare
(
s
.
size
()
-
suffix
.
size
(),
suffix
.
size
(),
suffix
));
}
bool
has_suffix
(
const
string
&
s
,
char
suffix
)
{
return
(
s
.
size
()
>=
1
&&
s
[
s
.
size
()
-
1
]
==
suffix
);
}
// XXX trim_prefix
string
trim_suffix
(
const
string
&
s
,
const
string
&
suffix
)
{
if
(
!
has_suffix
(
s
,
suffix
))
return
s
;
return
s
.
substr
(
0
,
s
.
size
()
-
suffix
.
size
());
}
string
trim_suffix
(
const
string
&
s
,
char
suffix
)
{
if
(
!
has_suffix
(
s
,
suffix
))
return
s
;
return
s
.
substr
(
0
,
s
.
size
()
-
1
);
}
vector
<
string
>
split
(
const
string
&
s
,
char
sep
)
{
vector
<
string
>
r
;
int
psep_prev
=-
1
;
size_t
psep
;
while
(
1
)
{
psep
=
s
.
find
(
sep
,
psep_prev
+
1
);
if
(
psep
==
string
::
npos
)
return
r
;
r
.
push_back
(
s
.
substr
(
psep_prev
+
1
,
sep
-
(
psep_prev
+
1
)));
psep_prev
=
sep
;
}
}
}
// strings::
// xstrconv:: (strconv-like)
namespace
xstrconv
{
...
...
wcfs/internal/wcfs_misc.h
View file @
934be047
...
...
@@ -127,23 +127,6 @@ namespace mm {
}
// mm::
// strings::
namespace
strings
{
bool
has_prefix
(
const
string
&
s
,
const
string
&
prefix
);
bool
has_prefix
(
const
string
&
s
,
char
prefix
);
bool
has_suffix
(
const
string
&
s
,
const
string
&
suffix
);
bool
has_suffix
(
const
string
&
s
,
char
suffix
);
string
trim_prefix
(
const
string
&
s
,
const
string
&
prefix
);
string
trim_prefix
(
const
string
&
s
,
char
prefix
);
string
trim_suffix
(
const
string
&
s
,
const
string
&
suffix
);
string
trim_suffix
(
const
string
&
s
,
char
suffix
);
vector
<
string
>
split
(
const
string
&
s
,
char
sep
);
}
// strings::
// ---- misc ----
...
...
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