So at work, we have hundreds of databases. Arranged by state, and a reference ID. Here are 5 examples:
Code: Select all
userinput:
;Any of this would work as userinput
CA61 - 65685 - Dunder miffin company - some street birch ave
TX31 - 77785 - Cow, boy and hide company - 666 boots street
MEX15 - 12345 - Mexican resort - 44 fancy street, Tijuana, MX
DC99 - 58559 - Generic Corporate Business Name - 55-405 Weird street address that you'll likely forget by the end of this sentence.
BRZ88 - 123456 - Local Brewery company - 24-7 Because I'm thirsty street, party it up. Brazil.
Currently I have this kind of thing:
Code: Select all
CODE1:=SubStr(userinput,1,4)
REF1:=SubStr(userinput, 9, 5)
or
Code: Select all
CODE1:=SubStr(userinput,1,5)
REF1:=SubStr(userinput, 9, 5)
or
Code: Select all
CODE1:=SubStr(userinput,1,5)
REF1:=SubStr(userinput, 9, 6)
I have 3 different scripts for the same.
I'm wondering if instead of using Subst userinput.
I could use something to detect the "-" symbosl and spaces, and just grab whatever number is in between.
CODE1= Whatever number is before the "-" and space symbol (" -")
REF1 = Whatever number is in between both hypens and spaces ("- ") and (" -")
Yeah, just wondering how would I ago about this, I'm sure it's super simple, but wanted to do a good job of explaining. Once that is set, I can implent that change to EVERYTHING IVE SCRIPTED!!!!!
Well at least like 20-40% for sure.
First one to answer gets a cookie!!!
Thanks!!!!