02-02-2026, 06:21 PM
(01-15-2026, 12:24 AM)ASCIIhole Wrote:Buggy. I posted this without realizing how buggy it was. Sorry.
(01-14-2026, 10:15 PM)ASCIIhole Wrote: It keeps track of balances and transactions for multiple accounts with an ability to search for transactions based on balance, transaction amount, transaction description or date. I find it quite useful
Posted this not 2 hours ago and I just found a bug I never noticed. The LongCenter$() FUNCTION doesn't work for short strings. This will fix that: [qb][FUNCTION LongCenter$ (Text$, MinCharactersPerLine%, MaxCharactersPerLine%, ScreenWidth%)
IF LEN(Text$) <= MaxCharactersPerLine% THEN Rtrn$ = Text$: GOTO EndOfLongCenterFUNCTION
TryAgain:
OriginalString$ = Text$: NumCharactersOnRemainingLine% = 0: CatchInfiniteLoops% = 0
DO
BeforeCutLocation% = LEN(Text$) - MaxCharactersPerLine%
CutLocation% = BeforeCutLocation%
DO
CutLocation% = CutLocation% + 1
LOOP UNTIL MID$(Text$, CutLocation%, 1) = " "
LastPart$ = MID$(Text$, CutLocation% + 1, LEN(Text$) - (CutLocation% + 1) + 1)
Text$ = MID$(Text$, 1, CutLocation% - 1)
CatchInfiniteLoops% = CatchInfiniteLoops% + 1: IF CatchInfiniteLoops% < 0 THEN MaxCharactersPerLine% = MaxCharactersPerLine% + 1: GOTO TryAgain
LOOP UNTIL LEN(Text$) <= MaxCharactersPerLine%
NumCharactersOnRemainingLine% = LEN(Text$)
CurrentCharactersPerLine% = MaxCharactersPerLine% + 1
DO WHILE NumCharactersOnRemainingLine% < MinCharactersPerLine%
CurrentCharactersPerLine% = CurrentCharactersPerLine% - 1
Text$ = OriginalString$
DO
BeforeCutLocation% = LEN(Text$) - CurrentCharactersPerLine%
CutLocation% = BeforeCutLocation%
DO
CutLocation% = CutLocation% + 1
LOOP UNTIL MID$(Text$, CutLocation%, 1) = " "
LastPart$ = MID$(Text$, CutLocation% + 1, LEN(Text$) - (CutLocation% + 1) + 1)
Text$ = MID$(Text$, 1, CutLocation% - 1)
LOOP UNTIL LEN(Text$) <= CurrentCharactersPerLine%
NumCharactersOnRemainingLine% = LEN(Text$)
CatchInfiniteLoops% = CatchInfiniteLoops% + 1: IF CatchInfiniteLoops% < 0 THEN MaxCharactersPerLine% = MaxCharactersPerLine% + 1: GOTO TryAgain
LOOP
CurrentCharactersPerLine% = CurrentCharactersPerLine% - 1
Text$ = OriginalString$
Rtrn$ = ""
DO
BeforeCutLocation% = LEN(Text$) - CurrentCharactersPerLine%
CutLocation% = BeforeCutLocation%
DO
CutLocation% = CutLocation% + 1
LOOP UNTIL MID$(Text$, CutLocation%, 1) = " "
LastPart$ = MID$(Text$, CutLocation% + 1, LEN(Text$) - (CutLocation% + 1) + 1)
SideSpaces% = INT((ScreenWidth% - LEN(LastPart$)) / 2)
Rtrn$ = SPACE$(SideSpaces%) + LastPart$ + SPACE$(SideSpaces%) + Rtrn$
IF (ScreenWidth% - LEN(LastPart$)) / 2 <> INT((ScreenWidth% - LEN(LastPart$)) / 2) THEN Rtrn$ = " " + Rtrn$
Text$ = MID$(Text$, 1, CutLocation% - 1)
CatchInfiniteLoops% = CatchInfiniteLoops% + 1: IF CatchInfiniteLoops% < 0 THEN MaxCharactersPerLine% = MaxCharactersPerLine% + 1: GOTO TryAgain
LOOP UNTIL LEN(Text$) <= CurrentCharactersPerLine%
SideSpaces% = INT((ScreenWidth% - LEN(Text$)) / 2)
Rtrn$ = SPACE$(SideSpaces%) + Text$ + SPACE$(SideSpaces%) + Rtrn$
IF (ScreenWidth% - LEN(LastPart$)) / 2 <> INT((ScreenWidth% - LEN(LastPart$)) / 2) AND Left% = 1 THEN Rtrn$ = " " + Rtrn$
NumCharactersOnRemainingLine% = LEN(Text$)
EndOfLongCenterFUNCTION:
LongCenter$ = Rtrn$
END FUNCTION/qb]
I went looking for the second and found it in the Renaissance. The mechanical clocks were too new to tick at different moments. The rhythm became permanent. -- ASCIIhole


Buggy. I posted this without realizing how buggy it was. Sorry.