当前位置:网站首页>[JS] intercepting string
[JS] intercepting string
2022-06-21 06:38:00 【Boyun V】
JS Intercepting string
The first one is :SubString
grammar :
start: The starting position of the string to be intercepted (from 0 Start)
end: At the end of the intercept
character string .substring(start,end)
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-EOCp7xhJ-1655712281113)(../../../images/image-20220620151640845.png)]](/img/c9/433064e1084735f5abb0c4080607cb.png)
Example :
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-4wHydei3-1655712281114)(../../../images/image-20220620151406333.png)]](/img/e6/b0c135bee7bbbd818d7c66f0408321.png)
The second kind :SubStr
grammar :
from: From which position to start intercepting ( from 0 Start counting )
length: How long is the interception limit (Default: Interception from from All characters from position to end )
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-BWKtdvdp-1655712281115)(../../../images/image-20220620151834477.png)]](/img/65/e5b422a6a8e69b58773122e626f1e8.png)
Such as :"20220620RS28204".substr(8)
Output results :==>'RS28204'
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-OPgGiUbX-1655712281115)(../../../images/image-20220620152301980.png)]](/img/8c/3b0f638c30e3665907dcbb9336acd8.png)
The third kind of :Slice[ Recommended ]
As shown in the figure below : and substring It's about the same , But more than its function More powerful !!=== Can use attachments
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-ktT4tMbo-1655712281116)(../../../images/image-20220620152411447.png)]](/img/aa/fe82dbbc05f65cc4e7703b77457d68.png)
Add :
Can extract a part of a string , And return the extracted part with a new string .
stringObject.slice(start,end)
start: The starting subscript of the fragment to be extracted . If it's a negative number , This parameter specifies the position from the end of the string . in other words ,
-1: The last character of a string ,-2 Refers to the penultimate character , And so on .
end: The subscript at the end of the segment to be extracted . If this parameter is not specified , The substring to be extracted includes start String to the end of the original string .
If the parameter is negative , So it specifies the position from the end of the string .
边栏推荐
- [graduation season] a brief talk on the learning experience before sophomore year
- Chapter 1: overview of database system (final review of database)
- [is the network you are familiar with really safe?] Wanziwen
- Part 4: JVM memory model from the perspective of hardware / source code
- delphi10 ftp文件名乱码问题
- PyG教程(1):初识Pytorch Geometric
- MySQL使用什么作为主键比较好
- How powerful are spectral graph neural networks
- 如何通过JDBC访问MySQL数据库?手把手实现登录界面(图解+完整代码)
- 异常的相关介绍
猜你喜欢

nametuple的源码为什么要使用.replace(‘,‘, ‘ ‘).split()而不是.split(‘,‘)

如何通过JDBC访问MySQL数据库?手把手实现登录界面(图解+完整代码)

Issue 6: which mainstream programming language should college students choose

第12期:Spark零基础学习路线

MySQL数据库基础:连接查询
![[JDBC from introduction to actual combat] JDBC basic customs clearance tutorial (comprehensive summary part I)](/img/70/9ccd367a24a8ef399a7f2cf425a2bb.png)
[JDBC from introduction to actual combat] JDBC basic customs clearance tutorial (comprehensive summary part I)

高考那些事

Are you sure about this filter?

PyG教程(2):图数据
![[MySQL] database multi table operation customs clearance tutorial (foreign key constraint, multi table joint query)](/img/d9/919687856f0da02f5ae837cb62a4a3.png)
[MySQL] database multi table operation customs clearance tutorial (foreign key constraint, multi table joint query)
随机推荐
Issue 13: Flink zero foundation learning route
[JDBC from starting to Real combat] JDBC Basic clearance tutoriel (Summary of the first part)
第7期:内卷和躺平,你怎么选
PyG教程(2):图数据
TypeError: iter() returned non-iterator of type ‘xxx‘
认知语言学之框架与脚本
Required Integer parameter ‘XXX‘ is not present
Excel_submit
[data mining] final review Chapter 1
Innovation project training: data analysis and visualization
TweenMax不规则几何图形背景带动画js特效
智能需要身体吗
154-Solana分发token
JPA的基本使用
工作那点事
5254. 卖木头块 动态规划
Regular expression Basics
C语言实现模拟银行存取款管理系统课程设计(纯C语言版)
C语言课程设计|学生成绩管理系统(含完整代码)
Leetcode database mysql topic (difficulty: simple)