javascript 提取字符串substring(),
分享于 点击 15004 次 点评:34
javascript 提取字符串substring(),
提取字符串substring()
substring() 方法用于提取字符串中介于两个指定下标之间的字符。
语法:
stringObject.substring(star,stop)
注意:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>string对象</title>
<script type="text/javascript">
var mystr="Hello World!"
document.write(mystr.substring(6)+ "<br />"); //提取‘World’;
document.write(mystr.substring(0,6)); //提取‘Hello’;
</script>
</head>
<body>
</body>
</html>
结果:
World!
Hello
相关文章
- 暂无相关文章
用户点评