UBound / LBound
Verfasst: So 4. Nov 2012, 15:33
Ich habe folgenden Code:
sub main()
msgbox Item_Anz("abc de")
end sub
public function Item_Anz(sStr as String, optional sDelim as String, optional bMode as Boolean)
Dim a() as string
if IsMissing(sDelim) then sDelim = " "
if IsMissing(bMode) then bMode = True
if len(sStr) = 0 then exit function
a = split(sStr, sDelim)
Item_Anz = UBound(a()) - LBound(a())
end function
Der Debuger sagt mir auf der letzten Zeile:
UBound(a()) ... <Out of Scope>
LBound(a()) ... <Out of Scope>
UBound(a) ... <Out of Scope>
LBound(a) ... <Out of Scope>
wobei
a(0) ... "abc"
a(1) ... "de"
Wieso sind alle "Bounds" <Out of Scope>?
sub main()
msgbox Item_Anz("abc de")
end sub
public function Item_Anz(sStr as String, optional sDelim as String, optional bMode as Boolean)
Dim a() as string
if IsMissing(sDelim) then sDelim = " "
if IsMissing(bMode) then bMode = True
if len(sStr) = 0 then exit function
a = split(sStr, sDelim)
Item_Anz = UBound(a()) - LBound(a())
end function
Der Debuger sagt mir auf der letzten Zeile:
UBound(a()) ... <Out of Scope>
LBound(a()) ... <Out of Scope>
UBound(a) ... <Out of Scope>
LBound(a) ... <Out of Scope>
wobei
a(0) ... "abc"
a(1) ... "de"
Wieso sind alle "Bounds" <Out of Scope>?