Hi,
Am Fri, 5 Feb 2021 14:43:22 -0800 (PST) schrieb Tatsujin:
> My array of strings is already sorted from A to Z:
>
> mySort(1) = "apples"
> mySort(2) = "apricot"
> mySort(3) = "banana"
> mySort(4) = "beans"
> mySort(5) = "bread"
> mySort(6) = "donuts"
> '... etc, etc..
> mySort(38) = "zuchini"
>
> Is there an easy function that can copy any alphabetical segment of the array into a new array?
if you don't know where your searched character starts in the array you
can search the words beginnig with your expected character with Reg.Exp:
Set re = CreateObject("vbscript.regexp")
myString = Join(mySort, ", ")
'modify the first character as expected
ptrn = "b.[a-z]{1,}"
re.Pattern = ptrn
re.Global = True
re.ignoreCase = True
Set matches = re.Execute(myString)
For Each match In matches
ReDim Preserve myArray(n)
myArray(n) = match
n = n + 1
Next
Regards
Claus B.
--
Windows10
Microsoft 365 for business