当前位置:网站首页>Dart 开发技巧
Dart 开发技巧
2022-06-30 09:34:00 【InfoQ】
Dart 中字符串货币格式的简单扩展
void main() {
print("1000".currency());
print("1300000".currency());
print("1005000".currency(symbol: '£'));
print("1000000".currency(symbol: '€'));
}
extension StringFormatter on String{
String currency({String symbol = "\$"}) {
int step = 1;
String val = this;
for (var i = val.length-1; i >=0; i--) {
if (i - 2*step > 0) {
val = val.replaceRange(i-2*step, i-2*step, ",");
step++;
}
}
return "$symbol$val";
}
}

使用 Flutter 在 Android 12 上验证 Android 应用链接
它是如何工作的?
await DomainVerificationManager.isSupported;- 已验证:已通过 Android 应用链接验证的域
- 已选中:未通过验证,但用户手动关联应用的域。
- 无:任何其他域
await DomainVerificationManager.domainStageVerified;
await DomainVerificationManager.domainStageSelected;
await DomainVerificationManager.domainStageNone;改变状态
await DomainVerificationManager.domainRequest();结论
边栏推荐
- Invalid update: invalid number of sections. The number of sections contained in the table view after
- I'm late for school
- Bluetooth BT RF test (forwarding)
- utils session&rpc
- Use of Baidu face recognition API
- Cronexpression expression explanation and cases
- Common query and aggregation of ES
- Pass anonymous function to simplification principle
- Express file upload
- Using appbarlayout to realize secondary ceiling function
猜你喜欢

MySQL knowledge summary (useful for thieves)

Microsoft. Bcl. Async usage summary -- in Net framework 4.5 project Net framework version 4.5 and above can use async/await asynchronous feature in C 5

Numpy (data type)

Solution to pychart's failure in importing torch package

Talk about how the kotlin collaboration process establishes structured concurrency

小程序手持弹幕的原理及实现(uni-app)

Baidu map JS browsing terminal
![[wechat applet] realize applet pull-down refresh and pull-up loading](/img/23/2668a3a36fd46f63732c753fd6f237.jpg)
[wechat applet] realize applet pull-down refresh and pull-up loading

ES6 learning path (II) let & const

【新书推荐】Cleaning Data for Effective Data Science
随机推荐
Distributed ID
Talking about the difference between kotlin collaboration and thread
How do I start? (continuously updating)
Clickhouse installation (quick start)
MySQL index optimization miscellaneous
布隆过滤器
2020-11-02
Use of Baidu face recognition API
ACM intensive training graph theory exercise 3 in the summer vacation of 2020 [problem solving]
ES6 learning path (IV) operator extension
Pass anonymous function to simplification principle
Recommend a very easy-to-use network communication framework HP socket
About MySQL Boolean and tinyint (1)
Terminal -- Zsh of terminal three swordsmen
Small program learning path 1 - getting to know small programs
Get to know handler again
Cb/s Architecture - Implementation Based on cef3+mfc
机器学习笔记 九:预测模型优化(防止欠拟合和过拟合问题发生)
4. use ibinder interface flexibly for short-range communication
【新书推荐】MongoDB Performance Tuning