js replace all & replaceAll
2024-08-30 07:47:28
js replace all & replaceAll
https://scotch.io/tutorials/javascript-replace-all-instances-of-a-string
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
replaceAll
https://developer.mozilla.org/en-US/search?q=replaceAll
view1.axis('date', {
title: false,
// label: {
// // offset: 40,
// autoRotate: true,
// textStyle: {
// // textAlign: 'start',
// // textAlign: 'end',
// // textAlign: 'middle',
// textAlign: 'center',
// // textAlign: 'right',
// // textAlign: 'left',
// // marginLeft: -100,
// rotate: 45,
// },
// },
label: {
// 使用 formatter 回调函数
formatter: val => {
// return val + '元';
// return val.replace(`-`, `/`);
// replaceAll
return val.replace(/-/ig, `/`);
}
}
});
replaceAll & non-global RegExp
ncaught TypeError: String.prototype.replaceAll called with a non-global RegExp argument at String.replaceAll
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll
let s = `A man, a plan, a canal: Panama`;
// all === g
s.replace(/[^0-9a-zA-Z]/g, ``);
// "AmanaplanacanalPanama"
// once
s.replace(/[^0-9a-zA-Z]/, ``);
// "Aman, a plan, a canal: Panama"
// not set global
s.replaceAll(/[^0-9a-zA-Z]/, ``);
// Uncaught TypeError: String.prototype.replaceAll called with a non-global RegExp argument
// global falg === g
s.replaceAll(/[^0-9a-zA-Z]/g, ``);
// "AmanaplanacanalPanama"
https://leetcode.com/submissions/detail/368182883/
shit G2 API docs
https://www.yuque.com/antv/g2-docs/tutorial-axes#8b47b027
g2 文档好神奇,没有的值也能用
https://www.yuque.com/antv/g2-docs/tutorial-g2-chart-composition
https://www.yuque.com/antv/g2-docs/tutorial-creating-chart
xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
最新文章
- 跟着老男孩教育学Python开发【第三篇】:Python函数
- ubuntu下面更改用户名的方法
- ionic 白屏
- ORA-12637解决问题
- Redis 常用链接
- .net网站能走多远
- 利用javascript实现课程选择
- Spring-RMI固定端口
- JVM调优-Java垃圾回收之分代回收
- MEF 编程指南(八):过滤目录
- 【HDOJ】4261 Estimation
- vs2010+ Ankhsvn使用详解
- codeforces 604B More Cowbell
- Sqoop简介及安装
- 201521123091 《Java程序设计》第12周学习总结
- SSH2三大框架SQL查询
- extjs 中比较常见且好用的监听事件
- 清除cookie
- 洛谷p1091合唱队形题解
- 腾讯云Ubuntu安装可视化桌面
热门文章
- Webpack4.0各个击破(8)tapable篇
- SpringMVC听课笔记(SpringMVC 表单标签 &; 处理静态资源)
- Language Guide (proto3) | proto3 语言指南(九)Oneof结构
- Java——对象和类
- java架构《并发线程基础一》
- python模块----sys模块 (系统相关的参数和函数)
- PHP-mysql存储照片的两种方式
- pytest测试框架+jenkins结合pytest+jenkins邮件通知配置
- jquery each报 Uncaught TypeError: Cannot use 'in' operator to search for错误
- 设计模式(十)——组合模式(HashMap源码解析)