mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-06-29 11:40:38 +00:00
One less loop for FUNCTION FindProposedTitle$
This commit is contained in:
parent
f99e12807c
commit
0df00de7f7
|
@ -14207,16 +14207,14 @@ FUNCTION FindProposedTitle$
|
||||||
'Finds the first occurence of _TITLE to suggest a file name
|
'Finds the first occurence of _TITLE to suggest a file name
|
||||||
'when saving for the first time or saving as.
|
'when saving for the first time or saving as.
|
||||||
|
|
||||||
FOR find_TITLE = 1 TO iden
|
DIM c AS _BYTE, q AS _BYTE, i
|
||||||
thisline$ = idegetline(find_TITLE)
|
FOR i = 1 TO iden
|
||||||
|
thisline$ = idegetline(i)
|
||||||
thisline$ = LTRIM$(RTRIM$(thisline$))
|
thisline$ = LTRIM$(RTRIM$(thisline$))
|
||||||
found_TITLE = INSTR(UCASE$(thisline$), "_TITLE " + CHR$(34))
|
found_TITLE = INSTR(UCASE$(thisline$), "_TITLE " + CHR$(34))
|
||||||
IF found_TITLE > 0 THEN
|
IF found_TITLE > 0 THEN
|
||||||
InQuote%% = 0
|
FindQuoteComment thisline$, found_TITLE, c, q
|
||||||
FOR check_quotes = 1 TO found_TITLE
|
IF NOT q THEN
|
||||||
IF MID$(thisline$, check_quotes, 1) = CHR$(34) THEN InQuote%% = NOT InQuote%%
|
|
||||||
NEXT check_quotes
|
|
||||||
IF NOT InQuote%% THEN
|
|
||||||
Find_ClosingQuote = INSTR(found_TITLE + 8, thisline$, CHR$(34))
|
Find_ClosingQuote = INSTR(found_TITLE + 8, thisline$, CHR$(34))
|
||||||
IF Find_ClosingQuote > 0 THEN
|
IF Find_ClosingQuote > 0 THEN
|
||||||
TempFound_TITLE$ = MID$(thisline$, found_TITLE + 8, (Find_ClosingQuote - found_TITLE) - 8)
|
TempFound_TITLE$ = MID$(thisline$, found_TITLE + 8, (Find_ClosingQuote - found_TITLE) - 8)
|
||||||
|
@ -14227,12 +14225,12 @@ FUNCTION FindProposedTitle$
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
InvalidChars$ = ":/\?*><|" + CHR$(34)
|
InvalidChars$ = ":/\?*><|" + CHR$(34)
|
||||||
FOR wipe_INVALID = 1 TO LEN(TempFound_TITLE$)
|
FOR i = 1 TO LEN(TempFound_TITLE$)
|
||||||
ThisChar$ = MID$(TempFound_TITLE$, wipe_INVALID, 1)
|
ThisChar$ = MID$(TempFound_TITLE$, i, 1)
|
||||||
IF INSTR(InvalidChars$, ThisChar$) = 0 THEN
|
IF INSTR(InvalidChars$, ThisChar$) = 0 THEN
|
||||||
Found_TITLE$ = Found_TITLE$ + ThisChar$
|
Found_TITLE$ = Found_TITLE$ + ThisChar$
|
||||||
END IF
|
END IF
|
||||||
NEXT wipe_INVALID
|
NEXT i
|
||||||
|
|
||||||
FindProposedTitle$ = LTRIM$(RTRIM$(Found_TITLE$))
|
FindProposedTitle$ = LTRIM$(RTRIM$(Found_TITLE$))
|
||||||
END FUNCTION
|
END FUNCTION
|
||||||
|
|
Loading…
Reference in a new issue