vb stringlength

Status
Not open for further replies.

siriusb

Cyborg Agent
Here's my try:
Code:
Dim strtemp As String, x As String
Dim i As Integer

strtemp = InputBox("Enter string here")

Do
    i = i + 1
    x = Mid(strtemp, i, 1)
    DoEvents
Loop While x <> ""

MsgBox i - 1
 

siriusb

Cyborg Agent
Here's a slightly modified version:
Code:
On Error Resume Next

Dim strtemp As String, x As String
Dim i As Integer

strtemp = InputBox("Enter string here")

Do
    i = i + 1
    x = ""
    x = Mid(strtemp, i, 1)
Loop While x <> ""

MsgBox i - 1
 
Status
Not open for further replies.
Top Bottom