Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Alexander Lapshin
common
Commits
f2aeeaac
Commit
f2aeeaac
authored
Sep 15, 2020
by
Alexander Lapshin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ new text methods
parent
3a194635
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
+40
-2
TextFunctions.h
utils/TextFunctions.h
+30
-1
TimeFunctions.h
utils/TimeFunctions.h
+10
-1
No files found.
utils/TextFunctions.h
View file @
f2aeeaac
...
@@ -57,7 +57,8 @@ static std::string ToStr(const double value, const int precision = 0)
...
@@ -57,7 +57,8 @@ static std::string ToStr(const double value, const int precision = 0)
if
(
precision
)
{
if
(
precision
)
{
ss
<<
std
::
setprecision
(
precision
);
ss
<<
std
::
setprecision
(
precision
);
}
else
{
}
else
{
ss
<<
std
::
setprecision
(
std
::
numeric_limits
<
double
>::
digits10
+
2
);
ss
<<
std
::
setprecision
(
std
::
numeric_limits
<
double
>::
digits10
+
2
);
}
}
...
@@ -447,3 +448,31 @@ bool in_array(const std::vector<T>& src, T subject)
...
@@ -447,3 +448,31 @@ bool in_array(const std::vector<T>& src, T subject)
{
{
return
std
::
find
(
std
::
begin
(
src
),
std
::
end
(
src
),
subject
)
!=
std
::
end
(
src
);
return
std
::
find
(
std
::
begin
(
src
),
std
::
end
(
src
),
subject
)
!=
std
::
end
(
src
);
}
}
inline
bool
substring_between
(
const
std
::
string
&
s
,
const
std
::
string
&
start_delim
,
const
std
::
string
&
stop_delim
,
std
::
string
&
result
)
{
const
auto
first_delim_pos
=
s
.
find
(
start_delim
);
if
(
first_delim_pos
==
std
::
string
::
npos
)
{
return
false
;
}
const
auto
end_pos_of_first_delim
=
first_delim_pos
+
start_delim
.
length
();
if
(
end_pos_of_first_delim
==
std
::
string
::
npos
)
{
return
false
;
}
unsigned
last_delim_pos
=
s
.
find_first_of
(
stop_delim
,
end_pos_of_first_delim
);
if
(
last_delim_pos
==
std
::
string
::
npos
)
{
return
false
;
}
result
=
s
.
substr
(
end_pos_of_first_delim
,
last_delim_pos
-
end_pos_of_first_delim
);
return
true
;
}
utils/TimeFunctions.h
View file @
f2aeeaac
...
@@ -492,4 +492,13 @@ inline std::string get_current_time(const std::string& format)
...
@@ -492,4 +492,13 @@ inline std::string get_current_time(const std::string& format)
ss
<<
std
::
put_time
(
std
::
gmtime
(
&
in_time_t
),
format
.
c_str
());
ss
<<
std
::
put_time
(
std
::
gmtime
(
&
in_time_t
),
format
.
c_str
());
return
ss
.
str
();
return
ss
.
str
();
}
}
\ No newline at end of file
inline
TimeJD
get_current_time
()
{
TimeGD
now
;
const
auto
s_now
=
get_current_time
(
"%d/%m/%Y %H:%M:%S"
);
StrToDate
(
s_now
,
now
);
return
now
;
}
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