找回密码
 立即注册
搜索
查看: 250|回复: 0

[Arduino 语法参考] String.remove()

[复制链接]

266

主题

0

回帖

1119

积分

管理员

积分
1119
发表于 2024-3-22 18:30:51 | 显示全部楼层 |阅读模式

remove()

[String 对象方法]

描述

原地修改一个字符串,从提供的索引位置开始,移除到字符串末尾的字符,或者从提供的索引位置开始,移除指定数量的字符。

语法

myString.remove(index)
myString.remove(index, count)

参数:

  • myString:一个类型为 String 的变量。
  • index:开始移除字符的位置(从0开始索引)。允许的数据类型:无符号整数(unsigned int)。
  • count:要移除的字符数量。允许的数据类型:无符号整数(unsigned int)。

返回值:

示例代码

String greeting = "hello";
greeting.remove(2, 2);  // greeting now contains "heo"


您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|棱讯科技 ( 粤ICP备2024228160号-2|粤公网安备44030002003510号 )

GMT+8, 2024-7-27 13:58 , Processed in 0.014760 second(s), 3 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表