Bible Searching

Sarah Reichelt sarah.reichelt at gmail.com
Thu Jan 12 16:27:21 EST 2006


>  Hello again everyone! I come to you today in reference to a project  I've
> been working on lately. I'm trying to make a bible studying program. I have  the
> books of the bible in TXT files in a folder (Just managing that was a
> task...). I wanted to add the ability to look up verses individually,  but the way
> the bible text is set up in those TXT files I'm having trouble  figuring out
> how to accomplish that. Here is an example of the way the  books are formatted
> consistently in TXT files (According by book):
>
>     Genesis 1:1-31
>
> 1 In [the] beginning God created the heavens and the earth.
>
> 2 Now the earth proved to be formless and waste and there was darkness  upon
> the surface of [the] watery deep; and God's active force was moving to and
> fro over the surface of the waters.

I guess it all depends on how the text files are set up and changing
them to make it easier to search may be the quickest way in the long
run. I would arrange it so that each book had it's own text file, so
you would have "Genesis.txt", "John.txt" etc.

When a search is done, you can load the correct text file quickly and
store it's text in a variable. Then you can get use lineOffset to find
the start of the chapter:

put lineOffset(bookName && chapterNum & ":", tBookText) into tStartLine

This gives you the starting point for the verse number search:

put lineOffset(cr & verseNum & space, tBookText, tStartLine) into tVerseLine
put tVerseLine + tStartLine into tVerseStartLineNumber

Then you want to find where that verse ends. You could do another
lineOffset looking for the next verse number, and go to the end of the
chapter if the next verse number can't be found, or you could step
through the lines looking for the next blank line and stopping there.

You may find that it is better to give people a stuctured way to enter
the search data rather than allowing free typing. Have a menu system
for selecting a book name, then a field with little arrows for
choosing chapter numbers and verse numbers. If you have already worked
out how many chapters each book has and how many verses each chapter
has, you can restrict the search data entry to numbers that are really
available.

Hopefully this has given you enough ideas to get started.

Cheers,
Sarah



More information about the use-livecode mailing list