Using Split Function:
str = "simple is sample str"
b = Split(str)
MsgBox UBound(b)+1 'Returns 4
Without using Split Function:
str = "simple is sample str"
count = 1
For i = 1 To Len(str)
b = Mid(str, i, 1)
If Not b = " " Then
t = t &b
Else
count = count+1
End If
Next
MsgBox count 'Returns 4
...
str = "simple is sample str"
b = Split(str)
MsgBox UBound(b)+1 'Returns 4
Without using Split Function:
str = "simple is sample str"
count = 1
For i = 1 To Len(str)
b = Mid(str, i, 1)
If Not b = " " Then
t = t &b
Else
count = count+1
End If
Next
MsgBox count 'Returns 4
...
No comments:
Post a Comment