当前位置:网站首页>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
边栏推荐
- Mathematical modeling for war preparation 33- grey prediction model 2
- Niuke network: longest continuous subarray with positive product
- Etcd教程 — 第八章 Etcd之Compact、Watch和Lease API
- 中航无人机科创板上市:市值385亿 拳头产品是翼龙无人机
- 2022蓝桥杯国赛B组-费用报销-(线性dp|状态dp)
- register_ Chrdev and CDEV_ init cdev_ Add usage differences
- Etcd教程 — 第九章 Etcd之实现分布式锁
- 云技能提升好伙伴,亚马逊云师兄今天正式营业
- 备战数学建模34-BP神经网络预测2
- Raft介绍
猜你喜欢
随机推荐
附加:(还没写,别看~~~)CorsFilter过滤器;
2020蓝桥杯国赛B组-搬砖-(贪心排序+01背包)
微信表情符号写入判决书,你发的OK、炸弹都可能成为“呈堂证供”
HMS Core音频编辑服务3D音频技术,助力打造沉浸式听觉盛宴
Cesium-1.72 learning (add points, lines, cubes, etc.)
register_chrdev和cdev_init cdev_add用法区别
[Demo] 循环写文件
Niuke.com: minimum cost of climbing stairs
赛芯电子冲刺科创板:拟募资6.2亿 实控人谭健为美国籍
POJ Project Summer
Implementation of aut, a self-developed transport layer protocol for sound network -- dev for dev column
Cmakelists Basics
Php7.3 centos7.9 installing sqlserver extensions
Home office discussion on the experience of remote assistance to quickly improve efficiency | community essay solicitation
Raft介绍
编译丨迅为iTOP4412开发板Makefile编译
The new tea drinks are "dead and alive", but the suppliers are "full of pots and bowls"?
HMS core audio editing service 3D audio technology helps create an immersive auditory feast
Hologres shared cluster helps Taobao subscribe to the extreme refined operation
dart:字符串replace相关的方法









