当前位置:网站首页>Dart: string replace related methods
Dart: string replace related methods
2022-06-30 16:58:00 【InfoQ】
replaceAll
void main() {
var a = ' Big front end ️ The journey ️';
var b = ' Big front end ️';
print(a.replaceAll('️', ''));
print(b.replaceAll(RegExp(r'(️)'), ''));
}

replaceAllMapped
String replaceAllMapped(
Pattern from,
String replace(Match match)
)
void main() {
var a = ' Big front end ️ The journey ️';
var b = ' Big front end ️';
print(a.replaceAllMapped('️', (Match m) => ''));
print(b.replaceAllMapped(RegExp(r'️'), (Match m) => ''));
}

replaceFirst
String replaceFirst(
Pattern from,
String to,
[int startIndex = 0]
)
void main() {
var d = ' Big front end tour ';
print(d.replaceFirst(RegExp(r'\ Big '), 'jianguo', 0)); //1ccc3
}

4.replaceFirstMapped
String replaceFirstMapped(
Pattern from,
String replace(Match match),
[int startIndex = 0]
) var e = 'asd';
print(e.replaceFirstMapped(RegExp(r'\w'), (Match m) => '${m[0]}${m[0]}', 2),);//asdd5.replaceRange
String replaceRange(
int start,
int end,
String replacement
)
var f = '123456789';
print(f.replaceRange(1, 3, 'replace')); //1replace456789
边栏推荐
- Etcd tutorial - Chapter 9 etcd implementation of distributed locks
- [machine learning] K-means clustering analysis
- Hologres共享集群助力淘宝订阅极致精细化运营
- 搬运两个负载均衡的笔记,日后省的找
- JS Es5 can also create constants?
- Mathematical modeling for war preparation 33- grey prediction model 2
- 华为帐号多端协同,打造美好互联生活
- On July 2, I invited you to TD Hero online conference
- [wechat applet] the hosting environment of the applet
- Php7.3 centos7.9 installing sqlserver extensions
猜你喜欢

OpenCV中LineTypes各枚举值(LINE_4 、LINE_8 、LINE_AA )的含义

Deep learning - (2) several common loss functions

restartProcessIfVisible的流程

The new tea drinks are "dead and alive", but the suppliers are "full of pots and bowls"?

《网络是怎么样连接的》读书笔记 - 汇总篇

【活动报名】探秘元宇宙,就差你了!7月2号我在深圳现场等你!

On July 2, I invited you to TD Hero online conference

Niuke.com: minimum cost of climbing stairs

容联云首发基于统信UOS的Rphone,打造国产化联络中心新生态

利用PIL进行不失真的resize
随机推荐
互联网研发效能实践之去哪儿网(Qunar)核心领域DevOps落地实践
7 月 2 日邀你来TD Hero 线上发布会
go-micro教程 — 第一章 快速入门
坚果云-在新电脑上同步移动硬盘的文件
Hologres共享集群助力淘宝订阅极致精细化运营
Etcd教程 — 第九章 Etcd之实现分布式锁
香港回归25周年 香港故宫博物馆正式开放成文化新地标
赛芯电子冲刺科创板:拟募资6.2亿 实控人谭健为美国籍
Symantec electronic sprint technology innovation board: Tan Jian, the actual controller, is an American who plans to raise 620million yuan
Deep learning - (2) several common loss functions
IndexSearch
快照和备份
Raft introduction
After 15 years of working on 21 types of hardware, where is Google?
2020蓝桥杯国赛B组-搬砖-(贪心排序+01背包)
备战数学建模35-时间序列预测模型
Eight basic sorting (detailed explanation)
Etcd教程 — 第八章 Etcd之Compact、Watch和Lease API
MC Instruction Decoder
Go micro tutorial - Chapter 1 getting started