mirror of https://github.com/aria2/aria2
2009-11-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten util::uitos() * src/util.hpull/1/head
parent
48175dcb3a
commit
8865b9e8e6
|
@ -1,3 +1,8 @@
|
|||
2009-11-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Rewritten util::uitos()
|
||||
* src/util.h
|
||||
|
||||
2009-11-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Code cleanup
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <numeric>
|
||||
#include <map>
|
||||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
|
||||
#include "SharedHandle.h"
|
||||
#include "IntSequence.h"
|
||||
|
@ -102,12 +103,13 @@ std::string uitos(T value, bool comma = false)
|
|||
while(value) {
|
||||
++count;
|
||||
char digit = value%10+'0';
|
||||
str.insert(str.begin(), digit);
|
||||
value /= 10;
|
||||
if(comma && count > 3 && count%3 == 1) {
|
||||
str.insert(str.begin()+1, ',');
|
||||
str += ',';
|
||||
}
|
||||
str += digit;
|
||||
value /= 10;
|
||||
}
|
||||
std::reverse(str.begin(), str.end());
|
||||
return str;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue