We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
var stringValue = "hello world"; alert(stringValue.charAt(1)); //"e"
var stringValue = "hello world"; alert(stringValue.charCodeAt(1)); //输出"101"
var stringValue = "hello "; var resrult = stringValue.concat("world"); alert(resrult); //"hello world" alert(stringValue); //"hello "
var stringValue = "hello world"; alert(stringValue.slice(3)); //"lo world" alert(stringValue.slice(3,7)); //"lo w"
var stringValue = "hello world"; alert(stringValue.indexOf("o")); //4 alert(stringValue.lastIndexOf("o")); //7
var stringValue = " hello world "; var trimSting = stringValue.trim(); alert(trimSting); //"hello world" alert(stringValue); //" hello world "
var text = "cat,bat,sat,fat"; var pattern = /.at/; var matches = text.match(pattern); alert(matches[0]); //"cat"
var text = "cat,bat,sat,fat"; var pos = text.search(/at/); alert(pos); //1
var text = "cat,bat,sat,fat"; var result = text.replace("at","ond"); alert(result); //"cond,bat,sat,fat" result = text.replace(/at/g,"ond"); alert(result); //"cond,bond,sond,fond"
The text was updated successfully, but these errors were encountered:
No branches or pull requests
方法列表
1.String.charAt(index)
2.String.charCodeAt(index)
3.String.concat(value)
4.String.slice(value1, value2)
5.String.indexOf(value)
6.String.trim( )
7.String.match(正则)
8.String.search(value)
9.String.replace(被替换的值, 用于替换的值)
参考文章
JS字符串的一些常用方法
The text was updated successfully, but these errors were encountered: