Questions

VB script

+
0 Votes
Locked

VB script

2rajesh.b
Hi

I have a string
String s1 = "IP>10.10.1.1 and IP<10.10.1.10";
String s2 = "10.10.1.7";

how to write a VB script to search my string s2 is in the range of s1.

as i am completely new to VB please help me out in solving my problem.
  • +
    0 Votes
    Tony Hopkinson

    First thing to do is rationalise s1
    s1min = "10.10.1.1"
    s1Max = "10.10.1.10"

    Then you need to use the split function

    IPMin = Split(s1Min,".")

    Will give you and array of strings "10", "10","1","1"

    So after you've split the others it's just a a lot of if statements
    if IPS2{0) >= IPMin(0)....

  • +
    0 Votes
    Tony Hopkinson

    First thing to do is rationalise s1
    s1min = "10.10.1.1"
    s1Max = "10.10.1.10"

    Then you need to use the split function

    IPMin = Split(s1Min,".")

    Will give you and array of strings "10", "10","1","1"

    So after you've split the others it's just a a lot of if statements
    if IPS2{0) >= IPMin(0)....