VBScript:函数返回一个数组 [英] VBScript: Function returns an array

查看:130
本文介绍了VBScript:函数返回一个数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些VBScript代码,其中一个函数返回一个数组.

I have some VBScript code where a function returns an array.

function PreProcessFile (sFile)

    dim deData(3)

    ''populate deData with strings

    PreProcessFile = deData

End function

调用此函数的代码错误,类型不匹配.有什么想法吗?

The code calling this function errs with a type mismatch. Any thoughts?

'' VBScript source code
Dim m_deData(3)
set m_deData = PreProcessFile("someFile.txt")

推荐答案

不要在函数外部显式地减小数组的大小,并且不要使用set:

Don't explicitly dim the size of the array outside the function and don't use set:

'' VBScript source code
Dim m_deData
m_deData = PreProcessFile("someFile.txt")

这篇关于VBScript:函数返回一个数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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