Simple program to capitalize a txt file.

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
Post Reply
lrcvs
Posts: 577
Joined: Mar 06, 2008 19:27
Location: Spain

Simple program to capitalize a txt file.

Post by lrcvs »

Code: Select all

'Simple program to capitalize a txt file.
'The simple program capitalizes the first character after a period / dot / point
	 
DIM AS STRING sa,sb,sc,sd
DIM AS INTEGER ib,ic,id
CLS
INPUT "file.ext: ";sa
CLS
OPEN sa FOR INPUT AS #1 
WHILE NOT EOF (1)
    LINE INPUT #1,sc
    id = LEN(sc)
    sd=""
    FOR ic = 1 TO id
        sb= MID(sc,ic,1)            
        IF sb <> " " AND sd = "" THEN MID(sc,ic)=UCASE(sb):sd = "*"
        IF sb = "." AND sd = "*" THEN
            FOR ib = ic+1 TO id
                IF sb>= "A" AND sb<= "Z" THEN EXIT FOR   
                sb= MID(sc,ib,1)
                IF sb>= "a" AND sb<= "z" AND sb <> " " THEN MID(sc,ib)=UCASE(sb):EXIT FOR
            NEXT ib
        END IF
    NEXT ic
    PRINT sc
WEND
CLOSE (1)
SLEEP
END
Post Reply