当前位置:网站首页>Important methods of array and string
Important methods of array and string
2022-07-06 12:07:00 【KAMHUNCHAN】
| Array | String |
|---|---|
| indexOf( Array elements , Specify where to start searching ) // Returns the first index number that satisfies the condition , If you can't find it, go back to -1 | str.indexOf(“ Search for characters ”, Start looking for the location ) // Return the first found subscript , Return if not found -1 |
| lastIIndexOf( Array elements ) // Returns the last index number that meets the condition , If you can't find it, go back to -1 | – |
| Convert to string arr.toString() ;arr.join("-") | Convert to array :str.split(’=’) |
| slice(begin,end) // Intercept array intercept array subscript from begin To end The content of , It doesn't contain endbegin Out of array range , Will return an empty array | slice(begin,end);substring(begin,end) Negative values are not acceptable , these two items. end It's a subscript , Can't get ;substr(star,length)length It's a number |
| splice(star,deleteCount,item1, item2, … Optional )-start Specify where to start the modification ( from 0 Count ). If the length of the array is exceeded , Then add content from the end of the array ; If it's negative , Represents the number of bits starting from the end of the array ( from -1 Count , It means -n It's the last n And is equivalent to array.length-n); If the absolute value of a negative number is greater than the length of the array , It means that the starting position is 0 position .deleteCount Optional integer , Represents the number of array elements to remove . If deleteCount Greater than start The total number of elements after , From start Later elements will be removed ( Hendy start position ). If deleteCount Was omitted , Or its value is greater than or equal to array.length - start( in other words , If it is greater than or equal to start The number of all elements after ), that start After that, all elements of the array will be deleted . If deleteCount yes 0 Or negative , The element is not removed . In this case , At least one new element should be added .item1, item2, … Optional elements to be added to the array , from start Position start . If you don't specify , be splice() Only array elements will be removed . The return value is an array of deleted elements . If only one element is deleted , Returns an array containing only one element . If the element is not deleted , Then return an empty array . This method will change the original array - | – |
边栏推荐
- [esp32 learning-2] esp32 address mapping
- Rough analysis of map file
- imgcat使用心得
- Vert. x: A simple TCP client and server demo
- Mp3mini playback module Arduino < dfrobotdfplayermini H> function explanation
- VSCode基础配置
- RT-Thread的main线程“卡死”的一种可能原因及解决方案
- uCOS-III 的特点、任务状态、启动
- Machine learning -- linear regression (sklearn)
- Arduino gets the length of the array
猜你喜欢

共用体(union)详解【C语言】

电商数据分析--用户行为分析

MySQL主从复制的原理以及实现

E-commerce data analysis -- salary prediction (linear regression)

RT-Thread 线程的时间片轮询调度

arduino JSON数据信息解析

Mysql database interview questions
![[esp32 learning-1] construction of Arduino esp32 development environment](/img/31/dc16f776b7a95a08d177b1fd8856b8.png)
[esp32 learning-1] construction of Arduino esp32 development environment

OPPO VOOC快充电路和协议

FTP文件上传文件实现,定时扫描文件夹上传指定格式文件文件到服务器,C语言实现FTP文件上传详解及代码案例实现
随机推荐
Fashion-Gen: The Generative Fashion Dataset and Challenge 论文解读&数据集介绍
R & D thinking 01 ----- classic of embedded intelligent product development process
电商数据分析--薪资预测(线性回归)
Small L's test paper
arduino UNO R3的寄存器写法(1)-----引脚电平状态变化
使用LinkedHashMap实现一个LRU算法的缓存
Selective sorting and bubble sorting [C language]
Time slice polling scheduling of RT thread threads
Oppo vooc fast charging circuit and protocol
优先级反转与死锁
Dead loop in FreeRTOS task function
Mall project -- day09 -- order module
5G工作原理详解(解释&图解)
【ESP32学习-1】Arduino ESP32开发环境搭建
Comparison of solutions of Qualcomm & MTK & Kirin mobile platform USB3.0
[esp32 learning-1] construction of Arduino esp32 development environment
Kconfig Kbuild
Pytorch-温度预测
arduino JSON数据信息解析
Raspberry pie tap switch button to use