Changeset 786 for cpp/frams/util/sstringutils.cpp
- Timestamp:
- 05/21/18 14:01:14 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/util/sstringutils.cpp
r785 r786 157 157 } 158 158 159 SString sstring Shorten(const SString &in, int maxlen)159 SString sstringDelimitAndShorten(const SString &in, int maxlen, bool show_length, const SString& before, const SString& after) 160 160 { 161 161 SString out; 162 162 if (in.len() > maxlen) 163 out = in.substr(0, maxlen / 2) + "..." + in.substr(in.len() - maxlen + maxlen / 2) + SString::sprintf(" (length %d)", in.len());163 out = in.substr(0, maxlen / 2) + "..." + in.substr(in.len() - maxlen + maxlen / 2); 164 164 else 165 out = in; 165 { 166 out = in; show_length = false; 167 } 166 168 sstringQuote(out); 169 out = before + out + after; 170 if (show_length) 171 out += SString::sprintf(" (length %d)", in.len()); 167 172 return out; 168 173 }
Note: See TracChangeset
for help on using the changeset viewer.