mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
tweaks (#1738)
* feat: edit dm filter * opt: browser * feat: sb userInfo * mod: tvPlayUrl
This commit is contained in:
committed by
GitHub
parent
9754b061dd
commit
bca5b0419c
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/foundation.dart' show kDebugMode, debugPrint;
|
||||
import 'package:get/get_utils/get_utils.dart';
|
||||
|
||||
abstract class NumUtils {
|
||||
abstract final class NumUtils {
|
||||
static final _numRegExp = RegExp(r'([\d\.]+)([千万亿])?');
|
||||
|
||||
static int _getUnit(String? unit) {
|
||||
@@ -59,4 +59,24 @@ abstract class NumUtils {
|
||||
return number.toString();
|
||||
}
|
||||
}
|
||||
|
||||
static String formatPositiveDecimal(int number) {
|
||||
if (number < 1000) return number.toString();
|
||||
|
||||
final numStr = number.toString();
|
||||
final length = numStr.length;
|
||||
final sb = StringBuffer();
|
||||
|
||||
int firstLength = length % 3;
|
||||
if (firstLength == 0) firstLength = 3;
|
||||
|
||||
sb.write(numStr.substring(0, firstLength));
|
||||
for (int i = firstLength; i < length; i += 3) {
|
||||
sb
|
||||
..write(',')
|
||||
..write(numStr.substring(i, i + 3));
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user