当前位置:网站首页>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 .
边栏推荐
- 基本类型和包装类的区别
- What are the advantages of e-mail marketing? Why do sellers of shopline independent station attach so much importance to it?
- cocoapod中的第三方库怎么引用本地头文件
- FPGA - 7系列 FPGA SelectIO -08- 高级逻辑资源之OSERDESE2
- Apple MDM Bypass 免越狱绕过MDM配置锁 免费
- 移动广告发展动向:撬动存量,精细营销
- PKG package node project (express)
- Is it safe to open a stock account? How to open a stock account?
- 手把手教你用Ucos
- Use the SQL SELECT count distinct query statement to count the total number of unique values of a field in the database
猜你喜欢
Exception handling (I) -- null pointer and array index out of bounds
Drop down list processing in Web Automation
RN7302三相电量检测(基于STM32单片机)
Online facing such an online world, the only limitation is our imagination
报错--解决core-js/modules/es.error.cause.js报错
D3D11_ Chili_ Tutorial (3): design a bindable/drawable system
Small ball playing
Common basic functions of Oracle
Error reporting - resolve core JS / modules / es error. cause. JS error
Apple MDM Bypass 免越狱绕过MDM配置锁 免费
随机推荐
What is the e-commerce conversion rate so abstract?
Integer promotion and size side byte order
MySQL common functions
D3D11_ Chili_ Tutorial (3): design a bindable/drawable system
Boost the rising point | yolov5 combined with alpha IOU
【Paper Reading-3D Detection】Fully Convolutional One-Stage 3D Object Detection on LiDAR Range Images
OpenGL API learning (2008) client server client server
Error reporting - resolve core JS / modules / es error. cause. JS error
手把手教你用Ucos
Difficulty calculation of Ethereum classic
idea创建类时自动添加注释
Configure multiple database connections using the SSM framework
EasyUI reset multi condition query
Introduction to openscap
ThreadLocal
Yygh-7-user management
异常处理(一)——空指针和数组索引越界
Install and manage multiple versions of PHP under mac
Mosaic data enhanced mosaic
Caused by: com. fasterxml. jackson. databind. Exc.invalidformatexception: exception resolution