vbscript中的字符到UTF代码
我想创建一个 .properties 文件以在 VBScript 的 Java 程序中使用。我将在使用 ASCII 映射之外的字符的语言中使用一些字符串。所以,我需要将这些字符替换为其 UTF 代码。对于 a,这将是 \u0061,对于 b,这将是 \u0062,依此类推。
有没有办法在 VBScript 中获取 char 的 UTF 代码?
I'd like to create a .properties file to be used in a Java program from a VBScript. I'm going to use some strings in languages that use characters outside the ASCII map. So, I need to replace these characters for its UTF code. This would be \u0061 for a, \u0062 fro b and so on.
Is there a way to get the UTF code for a char in VBScript?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
VBScript 具有
AscW
函数,该函数返回指定字符串中第一个字符的 Unicode(宽)代码。请注意,
AscW
以十进制数字形式返回字符代码,因此,如果您需要特定格式的字符代码,则必须为此编写一些额外的代码(问题是,VBScript 不具有不错的字符串格式化功能)。例如,如果您需要格式为\unnnn
的代码,则可以使用如下函数:VBScript has the
AscW
function that returns the Unicode (wide) code of the first character in the specified string.Note that
AscW
returns the character code as a decimal number, so if you need it in a specific format, you'll have to write some additional code for that (and the problem is, VBScript doesn't have decent string formatting functions). For example, if you need the code formatted as\unnnn
, you could use a function like this: