Reputation: 3987
How can I save an integer in two digits in Dart?
int i = 3;
String s = i.toString();
print(s);
The result should be 03 and not 3
Upvotes: 19
Views: 10137
Reputation: 802
To save the first two digits of an integer.
int val = 1546090;
print(val);
print(val.toString().substring(0,2));
Upvotes: -1