擦除函数用于重置固定大小数组的值并释放动态数组的内存。它的行为取决于数组的类型。
用法
Erase ArrayName
固定数值数组,数组中的每个元素都重置为零。
固定字符串数组,数组中的每个元素都重置为零长度 " "。
对象数组,数组中的每个元素都被重置为特殊值Nothing。
示例
<!DOCTYPE html>
<html>
<body>
<script language = "vbscript" type = "text/vbscript">
Dim NumArray(3)
NumArray(0) = "VBScript"
NumArray(1) = 1.05
NumArray(2) = 25
NumArray(3) = #23/04/2013#
Dim DynamicArray()
ReDim DynamicArray(9) ' Allocate storage space.
Erase NumArray ' Each element is reinitialized.
Erase DynamicArray ' Free memory used by array.
' All values would be erased.
Document.write("The value at Zeroth index of NumArray is " & NumArray(0) & "<br />")
Document.write("The value at First index of NumArray is " & NumArray(1) & "<br />")
Document.write("The value at Second index of NumArray is " & NumArray(2) & "<br />")
Document.write("The value at Third index of NumArray is " & NumArray(3) & "<br />")
</script>
</body>
</html>
当上面的代码保存为 .HTML 并在 Internet Explorer 中执行时,它会产生以下结果——
The value at Zero index of NumArray is The value at First index of NumArray is The value at Second index of NumArray is The value at Third index of NumArray is
相关用法
- VBScript UCase用法及代码示例
- VBScript InStrRev用法及代码示例
- VBScript TimeValue用法及代码示例
- VBScript UBound用法及代码示例
- VBScript IsArray用法及代码示例
- VBScript LBound用法及代码示例
- VBScript InStr用法及代码示例
- VBScript Left用法及代码示例
- VBScript DatePart用法及代码示例
- VBScript FormatDateTime用法及代码示例
- VBScript IsDate用法及代码示例
- VBScript Hour用法及代码示例
- VBScript Right用法及代码示例
- VBScript Mid用法及代码示例
- VBScript WeekDayName用法及代码示例
- VBScript Replace用法及代码示例
- VBScript Len用法及代码示例
注:本文由纯净天空筛选整理自 VBScript Erase Function。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。