拆分字符串并将每个输出放入 vbs 中的唯一变量中 [英] splitting string and putting each output into a unique variable in vbs

查看:23
本文介绍了拆分字符串并将每个输出放入 vbs 中的唯一变量中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图简单地通过字符串中每个单词之间的空格来分割字符串.然后我想将字符串的这些不同部分放入单独的变量中.我该怎么做?我有以下几点:

I am trying to split a string simply by the spaces between each word within the string. I then want to put these different parts of the string into separate variables. How do I go about doing this? I have the following:

strOperatingSystem = Microsoft Windows 7 专业版"

strVendor = ""
strEdition = ""
strTitle = ""
strVersion = ""

我想要结果.

strVendor = "Microsoft"
strEdition = "Windows"
strTitle = "Professional"
strVersion = "7"

`

任何帮助将不胜感激.

推荐答案

拆分 空格处的字符串并将结果数组的各个字段分配给相应的变量.

You Split the string at spaces and assign the individual fields of the resulting array to the respective variables.

strOperatingSystem = "Microsoft Windows 7 Professional"

arr = Split(strOperatingSystem)

strVendor  = arr(0)
strEdition = arr(1)
strTitle   = arr(3)
strVersion = arr(2)

这篇关于拆分字符串并将每个输出放入 vbs 中的唯一变量中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆