Parsing a name from mid-string

Started by stevengraff, February 18, 2014, 02:22:22 PM

Previous topic - Next topic

stevengraff

I have a string from which I need to get the name out of the middle:

numselected = "Additional, Sally Jackson : (248)111-8888 (Ph) Ms. Jackson "

I'm using:

     colonLoc = strIndex( numselected, " :", 1, @Fwdscan )
     commaLoc = strIndex( numselected, "," ,1, @fwdscan)
     fullName = strSub( numselected, commaloc + 2, colonLoc - commaLoc - 2 )

which works, but... I'm wondering if there isn't some much simpler way. Any ideas?

stanl

I doubt it is simpler, or even faster... but

Code (WINBATCH) Select

n = "Additional, Sally Jackson : (248)111-8888 (Ph) Ms. Jackson "
n1 =StrTrim(ItemExtract(1,ItemExtract(2,n,","),":"))
Message("",n1)