Home > Web Front-end > JS Tutorial > body text

How to get the intermediate value of a string with '' using JS? _javascript skills

WBOY
Release: 2016-05-16 19:19:28
Original
1463 people have browsed it
第一种方法:
var test = "c:\\abc\\123.txt";

alert( test.lastIndexOf( "\\" ) );

一些特殊的字符需要 用 转义字符  "\"       "\\" 就是表示 \         "\"" 表示 "

至于 获取 中间的123 ,你自己来了。
第二中:用正则表达式

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template