MCPcopy Create free account
hub / github.com/chrxh/alien / format

Method format

source/Base/StringHelper.cpp:7–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include <iomanip>
6
7std::string StringHelper::format(uint64_t n, char separator)
8{
9 std::string result;
10
11 std::string s = std::to_string(n);
12 do {
13 int len = std::min(3, static_cast<int>(s.length()));
14 if (result.empty()) {
15 result = s.substr(s.length() - len, len);
16 } else {
17 result = s.substr(s.length() - len, len) + separator + result;
18 }
19 s = s.substr(0, s.length() - len);
20 } while (!s.empty());
21
22 return result;
23}
24
25std::string StringHelper::format(float v, int fracPartDecimals)
26{

Callers 15

processGenomeHeaderMethod · 0.80
processNodeMethod · 0.80
processInternMethod · 0.80
processCellBaseTabMethod · 0.80
processSensorContentMethod · 0.80
processMethod · 0.80
processMethod · 0.80
processInternMethod · 0.80
processSettingsMethod · 0.80
processInternMethod · 0.80

Calls 3

to_stringFunction · 0.85
formatInternFunction · 0.85
lengthMethod · 0.80

Tested by 4

processCellBaseTabMethod · 0.64
processSensorContentMethod · 0.64