Results 1 to 3 of 3

Thread: checking each character in a string

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Posts
    274

    checking each character in a string

    a string for example consists of "hdjh568djd"
    i want to check every character in the string, if detected that character is not a value then exit the function.
    seems like this is not the way to do it?
    str="hdjh568djd"
    For Each Char In str
    If Val(Char) = 0 Then Exit For
    Next

  2. #2
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: checking each character in a string

    Code:
     
     str = "hdjh568djd"
     
     For i = 1 To Len(str)
       If Val(Mid(str, i, 1)) = 0 Then Exit For
     Next

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Posts
    274

    Re: checking each character in a string

    thanks for the help...it works

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width