S
scott
hi
I have a snippet of code that take a given string and uses 'split' to pop it
into an array for me
the string is being split with the space char as the seperator
the problem is that sometimes the string will contain x2 words, other times
x3 or x4
is there a way to count or return the number of array elements being created
from the split ?
code below
<snip>
'need to split aircraft names up for displayy purposes
strAircraft = Trim(AirCraftBox.Value)
arrAircraft = Split(strAircraft)
'most planes have 3 part names
If Count.arrAircraft() > 2 Then
strAircraft_Make = arrAircraft(0)
strAircraft_Model = arrAircraft(1) & " " &
arrAircraft(2)
'gulfs have 2 part names only
Else
strAircraft_Make = arrAircraft(0) & " " &
arrAircraft(1)
End If
</snip>
obviously this is not working, is there a method for dealing with this ? or
will I have to loop through all elements to determin how many there are
(seems a little inefficient that way round !)
thanks
_scott
I have a snippet of code that take a given string and uses 'split' to pop it
into an array for me
the string is being split with the space char as the seperator
the problem is that sometimes the string will contain x2 words, other times
x3 or x4
is there a way to count or return the number of array elements being created
from the split ?
code below
<snip>
'need to split aircraft names up for displayy purposes
strAircraft = Trim(AirCraftBox.Value)
arrAircraft = Split(strAircraft)
'most planes have 3 part names
If Count.arrAircraft() > 2 Then
strAircraft_Make = arrAircraft(0)
strAircraft_Model = arrAircraft(1) & " " &
arrAircraft(2)
'gulfs have 2 part names only
Else
strAircraft_Make = arrAircraft(0) & " " &
arrAircraft(1)
End If
</snip>
obviously this is not working, is there a method for dealing with this ? or
will I have to loop through all elements to determin how many there are
(seems a little inefficient that way round !)
thanks
_scott