本文演示了Javascript
搜索字符串并将搜索结果返回字符串的
方法,供大家
参考:
Javascript
操作字符串有一个匹配方法来搜索字符串。如果找到指定的字符串,则返回搜索字符串。如果找不到,则返回null。匹配方法是区分大小写的。
Hello World!;
(str.match document.write(世界)+ );
(str.match document.write(世界)+ );
(str.match document.write(世界)+ );
(str.match document.write(世界!;
返回结果:
世界
无效的
无效的
世界!
希望本文能对大家的javascript
程序设计有所帮助。