当前位置:网站首页>JS of learning notes -- split(), replace(), join()
JS of learning notes -- split(), replace(), join()
2022-06-28 06:23:00 【VIXeH】
Recently used split() This function , Suddenly, it feels very convenient
string.split(separator,limit)
Parameters 1: Optional . String or regular expression , Split from where specified by this parameter string Object.
Parameters 2: Optional . This parameter specifies the maximum length of the returned array . If this parameter is set , No more substrings will be returned than the array specified by this parameter . If the parameter is not set , The entire string will be split , Regardless of its length .
Returns an array of strings .
Take a chestnut :
Break this sentence down into words one by one ,
var str="How are you doing today?";
In this case, a space can be passed in ,
var n=str.split(" ");
n That's what it looks like :
n=[ 'How' , 'are' , 'you' , 'doing' , 'today?' ]
replace() Method is used to replace some characters with others in a string , Or replace a substring that matches a regular expression .
string.replace(searchvalue,newvalue)
Parameters 1: Mandatory , Replaced string
Parameters 2: Mandatory , Replace string
join() Method is used to convert all elements in the array into a string .
The elements are separated by the specified separator .
array.join(separator)
Parameters can be chosen . Specifies the separator to use . If this parameter is omitted , Then use comma as separator .
边栏推荐
- Parsing ng template with let total in NZ Pagination
- Configure multiple database connections using the SSM framework
- Install and manage multiple versions of PHP under mac
- Introduction to openscap
- How to add live chat in your Shopify store?
- CAD secondary development +nettopologysuite+pgis reference multi version DLL
- idea创建类时自动添加注释
- Taobao seo training video course [22 lectures]
- Exception handling (I) -- null pointer and array index out of bounds
- Use of JDBC
猜你喜欢

Drop down list processing in Web Automation

【Paper Reading-3D Detection】Fully Convolutional One-Stage 3D Object Detection on LiDAR Range Images

Independent station sellers are using the five e-mail marketing skills, do you know?

Use of JDBC

Difficulty calculation of Ethereum classic

Install and manage multiple versions of PHP under mac

AutoCAD C # Polyline Small Sharp angle Detection

Online facing such an online world, the only limitation is our imagination

mac下安装多个版本php并且进行管理

【Paper Reading-3D Detection】Fully Convolutional One-Stage 3D Object Detection on LiDAR Range Images
随机推荐
Shell script one click deployment (MySQL)
sql及list去重操作
Working principle of es9023 audio decoding chip
阿里云短信服务(完整指南),短信发送功能实现。
YOLOv5增加小目标检测层
No one can only use foreach to traverse arrays, right?
整型提昇和大小端字節序
cocoapod中的第三方库怎么引用本地头文件
The custom cube UI pop-up dialog supports multiple and multiple types of input boxes
High quality domestic stereo codec cjc8988, pin to pin replaces wm8988
使用SSM框架,配置多个数据库连接
Lombok @equalsandhashcode annotation how to make objects The equals () method compares only some attributes
Introduction to openscap
Global country (and region) information JSON data
EasyUI reset multi condition query
自定义 cube-ui 弹出框dialog支持多个且多种类型的input框
Error reporting - resolve core JS / modules / es error. cause. JS error
Install redis on windows and permanently change the password, and integrate redis with the SSM framework
三极管驱动无刷电机
Scripting and programming languages