aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-08-20 21:15:53 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-08-23 13:37:56 +0100
commit5524bc31510c8116e5e215635307ef973e6abe83 (patch)
tree19a3d2de03c5d7047aef1ffb734feb9bd35f97d5 /contrib
parentcontrib: add sync_info to rlwrap command set (diff)
downloadmonero-5524bc31510c8116e5e215635307ef973e6abe83.tar.xz
print peer id in 0 padded hex for consistency
Diffstat (limited to 'contrib')
-rw-r--r--contrib/epee/include/string_tools.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/contrib/epee/include/string_tools.h b/contrib/epee/include/string_tools.h
index 258caa49e..ce7b2fb87 100644
--- a/contrib/epee/include/string_tools.h
+++ b/contrib/epee/include/string_tools.h
@@ -314,6 +314,18 @@ POP_WARNINGS
return str;
}
//----------------------------------------------------------------------------
+ inline std::string pad_string(std::string s, size_t n, char c = ' ', bool prepend = false)
+ {
+ if (s.size() < n)
+ {
+ if (prepend)
+ s = std::string(n - s.size(), c) + s;
+ else
+ s.append(n - s.size(), c);
+ }
+ return s;
+ }
+ //----------------------------------------------------------------------------
template<class t_pod_type>
std::string pod_to_hex(const t_pod_type& s)
{