Hey guys,


I was wondering what the best possible way it would be to parse a
string that is delimitted irregularly.


Basically, I'm going to parse a log file that will contain a nodename,
but the naming convention for the server varies...ie:
CLIN - DATACOM1
FOCUS - TESTSVR1
FCGSVR2


As you can see, some of the nodes are delimitted by a "-" and some are
not... The purpose of parsing this string will be to extract the client

name from the server. I'm needing to parse the client name from the
server and see if it matches in an array and have it output to a
specific queue.


As an example,


FCGSVR2 ** FCG would be the client in this instance
CLIN - DATACOM1 ** CLIN would be the client here


Is this possible at all?
Fast replies would greatly be appreciated... project deadline is
near..and i'm stumped!


This is what I have so far:

myarray = Split("BRMC - RME-A ")
Dim ClientArray (5)
ClientArray(0) = "AHA"
ClientArray(1) = "AVH"
ClientArray(2) = "BRMC"
ClientArray(3) = "CCS"
ClientArray(4) = "FCG"
ClientArray(5) = "FCGCORP"
i=2
myfilterarray = Filter(myarray, ClientArray(i), True)
msgbox Join(myfilterarray)

---

How would I make it loop through the Array until myfilterarray returns
a value that is true?

Re: Parsing Irregualar delimitted Strings by egdelwonK

egdelwonK
Sat May 28 07:54:45 CDT 2005

Actually, found it..

Dim a, i
Dim b

a = Array("AHA" , "AVH" , "BRMC", "CCS", "FCG", "FCGCORP")
b = "BRMC - RME-A"
i = 0

Do Until InStr(b,a(i)) > 0
i=i+1

Loop

msgbox(a(i))


Re: Parsing Irregualar delimitted Strings by Joe

Joe
Sat May 28 08:21:02 CDT 2005

Hi,

<egdelwonK@gmail.com> wrote in message
news:1117284885.152165.47910@g47g2000cwa.googlegroups.com...
> Actually, found it..
>
> Dim a, i
> Dim b
>
> a = Array("AHA" , "AVH" , "BRMC", "CCS", "FCG", "FCGCORP")
> b = "BRMC - RME-A"
> i = 0
>
> Do Until InStr(b,a(i)) > 0
> i=i+1
>
> Loop
>
> msgbox(a(i))

Just a quick note with another alternative that may save you from an endless
Do loop, depending upon your data. If you exit a For loop, the value of the
counter is maintained. If the loop proceeds through the full count to its
natural exit, the counter is incremented to one step greater than the end
number. Try --

-----
dim a, b, i

a = array("AHA" , "AVH" , "BRMC", "CCS", "FCG", "FCGCORP")
b = "BRMC - RME-A"

for i= 0 to ubound(a)
if instr(b, a(i)) then exit for
next

select case (i>ubound(a))
case true: msgbox "not found"
case false: msgbox a(i)
end select
-----

Joe Earnest



Re: Parsing Irregualar delimitted Strings by egdelwonK

egdelwonK
Sat May 28 08:39:53 CDT 2005

Hey Thanks Joe, that'll save a few headaches later down the road. I
appreciate it!