How to count by programm whole lines belong to Chappter 1,2,3,4 etc
kkasiekk
Messages postés12Date d'inscriptiondimanche 11 octobre 2009StatutMembreDernière intervention 9 février 2015
-
24 oct. 2009 à 13:23
Caribensila
Messages postés2527Date d'inscriptionjeudi 15 janvier 2004StatutMembreDernière intervention16 octobre 2019
-
27 oct. 2009 à 21:35
Hi Friends
I am looking for solution for my programm ... Hope there is someone to help me with
As about my problem:
I have to redaging my file (*.txt one) and it looks like that:
X_1,1
X_1,1 and a text
x_1,2
x_1,2 and a text
in other words. There is a lot of lines (strings) of Holy Bible
I must to find solution to read it and to blockade UpDown component
when Chappter one is over (Let say Exodus 1 has 31 vesets) the second chappter has 25 wersets and so one, and so one...
How to count by programm whole lines belong to Chappter 1,2,3,4 etc.
I'll be greatfull for any sugestion from U
Please send it on my address kallas555@wp.pl
ps. I am polish beginner of Delphi and sorry for my English
Bacterius
Messages postés3792Date d'inscriptionsamedi 22 décembre 2007StatutMembreDernière intervention 3 juin 201610 24 oct. 2009 à 22:48
I am polish beginner of Delphi and sorry for my English
Why not try on English/Polish forums then, such as ExpertsExchange.com ? You currently are on a French website
Anyway, if I understand your problem, you want to count the number of lines that make up a chapter ? Maybe by starting on the first line of chapter 2, then walking through the textfile until you find "Chapter 2" or something like that ?
solilog
Messages postés273Date d'inscriptionsamedi 13 juin 2009StatutMembreDernière intervention18 avril 201510 24 oct. 2009 à 23:32
Bonsoir tous,
Just for this time we'll talk in english.
I'm interested by the subject, i also did some prog on bible verses. But your question is not clear at all.
- What do you want do. Just display the bible, starting anywhere and scroll on the verses and, at the end of a chapter display the next one, ... at end of a book (ie: Genesis) passing to next one (Exodus) ... to the end of the bible (Revelations)?
- Is the Bible text stored in a .txt file with the verses references format as shown in your question (xx_1,1) ?
- The verses references are repeated twice ? (strange)
- You want count :
- the verses
- or the lines needed in a tMemo (or tRichEdit) to display the verses ?
kkasiekk
Messages postés12Date d'inscriptiondimanche 11 octobre 2009StatutMembreDernière intervention 9 février 2015 25 oct. 2009 à 20:14
So, a lot of sugestions. but ... no solution
Bacterius your sugestion for me about polish sities is well, but
be sure that I asked there a lot of times and logic says I am here if on polish sities of Delphi I did not find ansfers
Greetings for All of you
solilog
Messages postés273Date d'inscriptionsamedi 13 juin 2009StatutMembreDernière intervention18 avril 201510 25 oct. 2009 à 21:38
Hi guys,
I've written a small prog last night for kkasiekk's problem.
A class with 2 tStrngList to keep references and text.
A readfile procedure sweeping the file extracting only lines with
- 1 .. 3 letters + '_' + number + "," plus number + space or tab
- a text after the last space / tab
A search proc to disply all verses containing a word or a string.
The code has nothing really genius, but if somone of you wants it ... (not enough technical interest to publish it)
Good night.
solilog
Caribensila
Messages postés2527Date d'inscriptionjeudi 15 janvier 2004StatutMembreDernière intervention16 octobre 201918 25 oct. 2009 à 22:33
Oeuf corse, u're right, Bacterius. TStringList is appropriate for *.text as in the f0xi's snippet which counts the number of lines...
But in fact, I think that a *.text is not appropriate in this case.
Let's imagine in the future, this holy text with a system of footnotes, for instance...
So I think that TFileStream'll be more appropriate to make this application evolving.
'coz a Bible without note is like Kama Sutra without illustration. No? :)))
Bacterius
Messages postés3792Date d'inscriptionsamedi 22 décembre 2007StatutMembreDernière intervention 3 juin 201610 25 oct. 2009 à 23:56
Sure, if you start putting illustrations & flash applets inside the holy text, it should be better to use TFileStream with a *.hff file (Holy File Format).
solilog
Messages postés273Date d'inscriptionsamedi 13 juin 2009StatutMembreDernière intervention18 avril 201510 26 oct. 2009 à 00:30
Bonsoir,
D3 guys, i use : fTxt : Text, assign, reset & readln, not sure stream exists in his Delphi3, so it'll work like that. I put data in tStringList, but i'll change to fixed array (same reason). I don't remember what was in D3.
Let's wait kkasiekk closes the post. I've proposed him to give him my source.
Yes there are footnotes and links to other verses (ll see that later), substring search with matching options (as sql LIKE *, %, ...) to extract all verses with that string (done last night), ... funny this problem in my sleepless nights.
Regards
solilog
Ah guys, maybe you'll help me. To read the txt file, check the verses and insert +/- 31000 verses in 2 tStringListit's (ref & verse itself) it's very quick (2/10e sec), but for display, i want insert them in a tReachEdit (to change font between ref & verse) it's very very slow (> 3 mn). I use rEdt.lines.add(myVerse), verse by verse in the reading loop after validity check.
so DO YOU KNOW A QUICKER WAY TO INSERT LINES IN A RICHEDIT ? Maybe creating a very big string (4/5 Mo here) and use other rEdit methods ? compatible with D3 ?
solilog
Messages postés273Date d'inscriptionsamedi 13 juin 2009StatutMembreDernière intervention18 avril 201510 26 oct. 2009 à 19:04
Hi guys,
Bacterius, i've tested your solution, no change. I did it in the loop, verse by verse using rEdit.lines.add( myline ) and also rEdit.lines.text := AllTxt (a string with all the lines). Same duration (5' 45'') with & without Beginupdate/endupdate.
try
form1.rEdit.Lines.beginupdate;
form1.rEdit.lines.text := AllTxt;
form1.rEdit.Lines.endupdate;
finally
result := vCount;
end;
No way to speed adding lins, idem with tMemo, also very slow.
Bye
solilog