diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-03-26 15:33:06 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-03-26 15:33:06 -0400 |
commit | 0e6355329f241a3e3c8b38cb4146fda4470e6ed0 (patch) | |
tree | df5853ba6df148e8eeb0082d090dfbcd9f94f651 /util.h | |
parent | 09acb46a9c32257b0003eb152d32c15b43b95dfe (diff) | |
download | cadence-0e6355329f241a3e3c8b38cb4146fda4470e6ed0.tar.gz cadence-0e6355329f241a3e3c8b38cb4146fda4470e6ed0.tar.bz2 cadence-0e6355329f241a3e3c8b38cb4146fda4470e6ed0.zip |
Whitespace changes
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/util.h b/util.h index 8a476da..5d16649 100644 --- a/util.h +++ b/util.h | |||
@@ -8,7 +8,7 @@ | |||
8 | #include <sstream> | 8 | #include <sstream> |
9 | 9 | ||
10 | namespace cadence { | 10 | namespace cadence { |
11 | 11 | ||
12 | inline std::string uppercase(std::string in) | 12 | inline std::string uppercase(std::string in) |
13 | { | 13 | { |
14 | std::string result; | 14 | std::string result; |
@@ -16,28 +16,28 @@ namespace cadence { | |||
16 | { | 16 | { |
17 | return std::toupper(ch); | 17 | return std::toupper(ch); |
18 | }); | 18 | }); |
19 | 19 | ||
20 | return result; | 20 | return result; |
21 | } | 21 | } |
22 | 22 | ||
23 | template <class InputIterator> | 23 | template <class InputIterator> |
24 | std::string implode(InputIterator first, InputIterator last, std::string delimiter) | 24 | std::string implode(InputIterator first, InputIterator last, std::string delimiter) |
25 | { | 25 | { |
26 | std::stringstream result; | 26 | std::stringstream result; |
27 | 27 | ||
28 | for (InputIterator it = first; it != last; it++) | 28 | for (InputIterator it = first; it != last; it++) |
29 | { | 29 | { |
30 | if (it != first) | 30 | if (it != first) |
31 | { | 31 | { |
32 | result << delimiter; | 32 | result << delimiter; |
33 | } | 33 | } |
34 | 34 | ||
35 | result << *it; | 35 | result << *it; |
36 | } | 36 | } |
37 | 37 | ||
38 | return result.str(); | 38 | return result.str(); |
39 | } | 39 | } |
40 | 40 | ||
41 | template <class OutputIterator> | 41 | template <class OutputIterator> |
42 | void split(std::string input, std::string delimiter, OutputIterator out) | 42 | void split(std::string input, std::string delimiter, OutputIterator out) |
43 | { | 43 | { |
@@ -48,12 +48,12 @@ namespace cadence { | |||
48 | { | 48 | { |
49 | *out = input; | 49 | *out = input; |
50 | out++; | 50 | out++; |
51 | 51 | ||
52 | input = ""; | 52 | input = ""; |
53 | } else { | 53 | } else { |
54 | *out = input.substr(0, divider); | 54 | *out = input.substr(0, divider); |
55 | out++; | 55 | out++; |
56 | 56 | ||
57 | input = input.substr(divider+delimiter.length()); | 57 | input = input.substr(divider+delimiter.length()); |
58 | } | 58 | } |
59 | } | 59 | } |
@@ -63,12 +63,12 @@ namespace cadence { | |||
63 | Container split(std::string input, std::string delimiter) | 63 | Container split(std::string input, std::string delimiter) |
64 | { | 64 | { |
65 | Container result; | 65 | Container result; |
66 | 66 | ||
67 | split(input, delimiter, std::back_inserter(result)); | 67 | split(input, delimiter, std::back_inserter(result)); |
68 | 68 | ||
69 | return result; | 69 | return result; |
70 | } | 70 | } |
71 | 71 | ||
72 | }; | 72 | }; |
73 | 73 | ||
74 | #endif /* end of include guard: UTIL_H_CED7A66D */ | 74 | #endif /* end of include guard: UTIL_H_CED7A66D */ |