当前位置:网站首页>dart:字符串replace相关的方法
dart:字符串replace相关的方法
2022-06-30 15:48:00 【InfoQ】
replaceAll
void main() {
var a = '大前端️之旅️';
var b = '大前端️';
print(a.replaceAll('️', ''));
print(b.replaceAll(RegExp(r'(️)'), ''));
}

replaceAllMapped
String replaceAllMapped(
Pattern from,
String replace(Match match)
)
void main() {
var a = '大前端️之旅️';
var b = '大前端️';
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 = '大前端之旅';
print(d.replaceFirst(RegExp(r'\大'), '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
边栏推荐
- MC Instruction Decoder
- GaussDB创新特性解读:Partial Result Cache,通过缓存中间结果对算子进行加速
- Eight basic sorting (detailed explanation)
- Additional: (not written yet, don't look at ~ ~ ~) webmvcconfigurer interface;
- 安全帽佩戴检测算法研究
- Cesium-1.72 learning (earth model creation online offline tile)
- Mathematical modeling for war preparation 36 time series model 2
- 更多龙蜥自研特性!生产可用的 Anolis OS 8.6 正式发布
- Hologres共享集群助力淘宝订阅极致精细化运营
- Niuke: how many different binary search trees are there
猜你喜欢

【Verilog基础】关于Clock信号的一些概念总结(clock setup/hold、clock tree、clock skew、clock latency、clock transition..)

Distributed machine learning: model average Ma and elastic average easgd (pyspark)

快照和备份

The meaning of linetypes enumeration values (line_4, line_8, line_aa) in opencv
![[BJDCTF2020]The mystery of ip|[CISCN2019 华东南赛区]Web11|SSTI注入](/img/c2/d6760826b81589781574aebff61f9a.png)
[BJDCTF2020]The mystery of ip|[CISCN2019 华东南赛区]Web11|SSTI注入

Carry two load balancing notes and find them in the future

更多龙蜥自研特性!生产可用的 Anolis OS 8.6 正式发布

Symantec electronic sprint technology innovation board: Tan Jian, the actual controller, is an American who plans to raise 620million yuan

After 15 years of working on 21 types of hardware, where is Google?

Wechat emoticons are written into the judgment, and the OK and bomb you send may become "testimony in court"
随机推荐
More dragon lizard self-developed features! Production available Anolis OS 8.6 officially released
备战数学建模34-BP神经网络预测2
Bc1.2 PD protocol
simpleITK读取nii遇到ITK only supports orthonormal direction cosines的错误
Wechat emoticons are written into the judgment, and the OK and bomb you send may become "testimony in court"
【Verilog基础】关于Clock信号的一些概念总结(clock setup/hold、clock tree、clock skew、clock latency、clock transition..)
猎头5万挖我去VC
居家办公浅谈远程协助快速提效心得 | 社区征文
2022 Blue Bridge Cup group B - expense reimbursement - (linear dp| status DP)
2022新消费半年盘点:行业遇冷,但这九个赛道依然吸金
Mysql8 error: error 1410 (42000): you are not allowed to create a user with grant solution
IO流_递归
Li Zexiang, a legendary Chinese professor, is making unicorns in batches
【微信小程序】常用组件基本使用(view/scroll-view/swiper、text/rich-text、button/image)
华为帐号多端协同,打造美好互联生活
腾讯二面:@Bean 与 @Component 用在同一个类上,会怎么样?
Niuke network: longest continuous subarray with positive product
八大基本排序(详解)
[activity registration] it's your turn to explore the yuan universe! I will be waiting for you in Shenzhen on July 2!
Carry two load balancing notes and find them in the future