windows - JScript 是否支持字符串修剪方法?

标签 windows wsh jscript windows-scripting

在使用 JScript 开发 Windows 程序时,似乎某些字符串方法无法工作。在这个使用 trim 的示例中,第 3 行生成运行时错误:

"Object doesn't support this property or method".

我的代码:

strParent = "  a  ";
strParent = strParent.trim();
WScript.Echo ("Value: " + strParent);

我是不是傻了? 知道问题出在哪里吗?

最佳答案

在 Windows 脚本宿主下运行的 JScript 使用基于 ECMAScript 3.0 的旧版本 JScript。 trim函数是在 ECMAScript 5.0 中引入的。

关于windows - JScript 是否支持字符串修剪方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31506907/

相关文章:

PHP 和 Unicode : Weirdness between Windows and Linux

internet-explorer - 循环浏览网页并复制数据

javascript - 在 HTA 文件中使用 Javascript 从 Windows 注册表读取/写入

internet-explorer - 如何检查Internet Explorer COM对象的版本号

javascript - 哪个先执行?

windows-7-x64 - 如何使用 Jscript 打印文件

javascript - 混合批处理/jscript/hta : read 2 inputs in Jscript and pass them to Batch

windows - 我将如何定期备份 Windows 应用程序日志?

java - 如何为同时安装 mysql 的 java 程序制作安装程序?

c++ - windows - 如何链接 API 集 (*ms-win*) 而不是 kernel32.dll、ntdll.dll 等?