BoBo wrote: ↑10 Jul 2020, 11:27
TXShooter wrote: ↑10 Jul 2020, 10:52
Thanks, @BoBo .
Here's where my rabbit trail took me:
[...]
Well, what you are doing in your script is a default feature of AHK ...
Will Loop, Parse work inside another Loop, Parse?
In my original script, I'm first searching for delimiters of `,%A_Space%:-;
Code: Select all
Loop, Parse, CellOpen_Verse, `,%A_Space%:-;
{
; Calculate the position of the delimiter at the end of this field.
Position += StrLen(A_LoopField) + 1
; Retrieve the delimiter found by the parsing loop.
Delimiter := SubStr(CellOpen_Verse, Position, 1)
; Output current results for test
MsgBox, , BuildURL Step 1, % "Entry: " CellOpen_Verse "`nLoop: " A_Index "`nField: " A_LoopField "`nDelimiter: " Delimiter
; Check A_LoopField at each Delimiter.
if (Delimiter = " ") ; Delimiter is a space, which could be after the first Book entry (ie "John 1"),
{ ; or between Book number and Book name (ie "1 John"),
; or after an Entry delimiter of ";" (ie. "John 1:1-3; John 2:1")
if (Position > 1)
if (GetChar(A_LoopField,Position-1) is alpha) ; Book Found. Store it in %Book% array (untested)
}
I'm wanting to evaluate a string such as, "Luke 10:38-42, 32; Genesis 1:1-20,32,35" to break it down into Books, Chapters, and Verses, so that the results will be:
Code: Select all
Book := ["Luke","Luke","Genesis","Genesis","Genesis"]
Chapter := ["10","10","1","1","1"]
Verses := ["38-42","32","1-20","32","35"]
Ultimately I'm trying to build this so that each array entry can be used to build some HTML code, one URL per %Entry%:
Code: Select all
Entry := "[LUK.10:37.42","LUK.10:31","GEN.1:1.20","GEN.1:32","GEN.1:35"]
I figure that there has to be a lot of sub-searching to get %Entry%, or even %Book%, %Chapter%, %Verse% arrays built.
So how will another instance of Loop, Parse work inside the current one?
In one 'sub-search' for the Delimiter of %Space%, I'm needing to evaluate the character before each %Space% in the 'outer' Loop, Parse. If it's an alpha, then I have found a Book Title (ie "John 1"), otherwise I need to evaluate if the space comes after a book number (ie "1 John"). And to complicate things further, I'm needing to evaluate if the space happens after a semicolon (ie. "John 1:10-11; John 2:23"), which indicates a second Book Title and that specific %Space% is garbage.
Sooo... in your opinion, which approach should I take?