diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-08-20 21:15:53 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-08-23 13:37:56 +0100 |
commit | 5524bc31510c8116e5e215635307ef973e6abe83 (patch) | |
tree | 19a3d2de03c5d7047aef1ffb734feb9bd35f97d5 /contrib | |
parent | contrib: add sync_info to rlwrap command set (diff) | |
download | monero-5524bc31510c8116e5e215635307ef973e6abe83.tar.xz |
print peer id in 0 padded hex for consistency
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/epee/include/string_tools.h | 12 |
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) { |