Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ag-ohlberger
dune-community
dune-xt
Commits
bd42ac2f
Commit
bd42ac2f
authored
8 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[string] add to_camel_case
parent
1c7f229e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/xt/common/string.cc
+14
-0
14 additions, 0 deletions
dune/xt/common/string.cc
dune/xt/common/string.hh
+6
-0
6 additions, 0 deletions
dune/xt/common/string.hh
with
20 additions
and
0 deletions
dune/xt/common/string.cc
+
14
−
0
View file @
bd42ac2f
...
...
@@ -13,6 +13,7 @@
#include
<algorithm>
#include
<cctype>
#include
<string>
#include
<sstream>
#include
"string.hh"
...
...
@@ -37,6 +38,19 @@ std::string to_upper(const std::string& ss)
}
std
::
string
to_camel_case
(
const
std
::
string
&
ss
)
{
std
::
stringstream
out
;
for
(
auto
&&
word
:
tokenize
(
ss
,
"_"
,
boost
::
algorithm
::
token_compress_on
))
{
if
(
word
.
size
()
>
0
)
{
out
<<
to_upper
(
word
.
substr
(
0
,
1
));
out
<<
word
.
substr
(
1
);
}
}
return
out
.
str
();
}
}
// namespace Common
}
// namespace XT
}
// namespace Dune
This diff is collapsed.
Click to expand it.
dune/xt/common/string.hh
+
6
−
0
View file @
bd42ac2f
...
...
@@ -128,6 +128,12 @@ std::string to_lower(const std::string& ss);
std
::
string
to_upper
(
const
std
::
string
&
ss
);
/**
* \brief Converts this_sample_string to ThisSampleString.
*/
std
::
string
to_camel_case
(
const
std
::
string
&
ss
);
/**
\brief Returns a string of lengths t' whitespace (or whitespace chars).
\param[in] t defines the length of the return string (after conversion to string)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment