Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Finances Utility
#7
(01-15-2026, 12:24 AM)ASCIIhole Wrote: Sleepy   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 Rolleyes

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 
Reply


Messages In This Thread
Simple Finances Utility - by ASCIIhole - 01-14-2026, 10:15 PM
RE: Simple Finances Utility - by ASCIIhole - 01-15-2026, 12:24 AM
RE: Simple Finances Utility - by ASCIIhole - 02-02-2026, 06:21 PM
RE: Simple Finances Utility - by ahenry3068 - 01-15-2026, 12:57 AM
RE: Simple Finances Utility - by ASCIIhole - 01-15-2026, 02:42 PM
RE: Simple Finances Utility - by ahenry3068 - 01-15-2026, 03:08 PM
RE: Simple Finances Utility - by bplus - 01-15-2026, 05:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Marquee Utility / Demo for Screen 0 Pete 3 635 09-18-2025, 12:42 AM
Last Post: Pete
  Keymapper Utility eoredson 0 524 05-31-2025, 01:38 AM
Last Post: eoredson
  Another Directory Tree Utility eoredson 0 502 04-18-2025, 02:52 AM
Last Post: eoredson
  The Copyit Utility eoredson 4 1,304 04-17-2025, 04:11 AM
Last Post: eoredson
  Off-topic utility krovit 0 458 04-09-2025, 02:28 PM
Last Post: krovit

Forum Jump:


Users browsing this thread: 1 Guest(s)