我有一个如下代码。使用以下代码分割数字。现在我需要在MyArray
中拆分值存储 <html>
<body onload = "VerifyTimeSelectionNew();">
<script language="VBScript">
Const LEVEL_DATE_RANGE1 = 110
Function VerifyTimeSelectionNew()
'Dim cboTime
'cboTime = document.getElementsByName("TimeDropdown:cboTime")
'If CInt(cboTime.options(cboTime.selectedIndex).value) = LEVEL_DATE_RANGE1 Then
Dim hdnTime
Dim MyArray, i, newValue,value,newArray
hdnTime="0:0:0:0:0:2:201201:201311:False:False:True:False"
MyArray = Split(hdnTime, ":")
For i = 0 to 3
MsgBox (MyArray(i))
Next
value = MyArray(7)
newArray = split(value ,"")
// newValue = value.substring(0,4)
MsgBox(newArray(0))
End Function
</script>
</body>
</html>
当我执行这个到201311时。我无法拆分201311.你能告诉我y ???
答案 0 :(得分:0)
您的代码段有几个问题。
Substring()
。请改用Left
功能。更改这些行:
Dim value As String = "JohnRich"
Dim subString As String = value.Substring(0,4)
进入这个:
Dim value : value = "JohnRich"
Dim subString : subString = Left(value, 4)
或者这个:
Dim value, subString
value = "JohnRich"
subString = Left(value, 4)