REPLACE函数根据您指定的字符数,用不同的文本字符串替换文本字符串的一部分。
REPLACEB根据您指定的字节数,用不同的文本字符串替换文本字符串的一部分。
REPLACE适用于使用单字节字符集(SBCS)的语言,而REPLACEB适用于使用双字节字符集(DBCS)的语言。您计算机上的默认语言设置会影响返回值,如下所示:
来源:LearnFk无涯教程网
REPLACE始终将每个字符(无论是单字节还是双字节)都计为1,无论默认语言设置是什么。
REPLACEB在启用对支持DBCS的语言的编辑并将其设置为默认语言后,会将每个双字节字符计数为2。否则,REPLACEB将每个字符计数为1。
支持DBCS的语言包括日语,中文(简体),中文(繁体)和韩语。
REPLACE (old_text, start_num, num_chars, new_text) REPLACEB (old_text, start_num, num_bytes, new_text)
Argument | 描述 | Required/Optional |
---|---|---|
Old_text | Text in which you want to replace some characters. | Required |
Start_num | The position of the character in old_text that you want to replace with new_text. | Required |
Num_chars | The number of characters in old_text that you want REPLACE to replace with new_text. | Required |
Num_bytes | The number of bytes in old_text that you want REPLACEB to replace with new_text. | Required |
New_text | The text that will replace characters in old_text. | Required |
如果start_num或num_chars为负数或非数字,则REPLACE返回#VALUE!错误值。
Excel 2007,Excel 2010,Excel 2013,Excel 2016
这一章《JavaScript - REPLACE函数》你学到了什么?在下面做个笔记吧!做站不易,你的分享是对我们最大的支持
在 Javascript 中为 gulpfile.js 舍入 const 变量列表的更好方法...
请帮助我理解Javascript下面“handleEvent”方法下的代码
为什么这个时钟上没有秒针? (带有 javascript 的 HTML5 cavas...