interrogating a string

Results 1 to 3 of 3

Thread: interrogating a string

  1. #1
    Join Date
    Dec 1969

    Default interrogating a string

    Hello,<BR><BR>I am trying to find a way to have a variable eg “127.66” (this number will be changing with every page request) then take the first character for example “1” and assign it a variable then take the second character “2” and assign it another variable. The only other catch is that it would also have to find both the 6s and not just the first. Any help would be very welcome..<BR><BR>Thanks,<BR><BR>Clark

  2. #2
    arjuna Guest

    Default RE: interrogating a string

    you need to write a function that first figures out the length of the string, then grabs on character at a time (strating at the left) - you&#039;ll probably want to put those values into a dynamic array<BR><BR>if you reach the end of the string at any point of this process, jump out of the loop<BR><BR>if you come across a "." then start at the very next character and, using Mid(), grab the remaining characters in the string and put them into a variable<BR><BR>voila!

  3. #3
    Join Date
    Dec 1969

    Default RE: interrogating a string

    Dim myArray(5)<BR>Dim i, j<BR>Dim myString<BR><BR>j = 0<BR>myString = "127.66"<BR><BR>For i = 1 To Len(myString)<BR> If IsNumeric(Mid(myString, i, 1)) Then<BR> myArray(j) = Mid(myString, i, 1)<BR> j = j + 1;<BR> End If<BR>Next<BR><BR>This will give you a separate number in each element of the array.

Posting Permissions

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