BBS: Inland Empire Archive
Date: 05-12-92 (11:56) Number: 10
From: DAVID POSKIE Refer#: NONE
To: EDDIE ROWE Recvd: NO
Subj: Firstcaps Function Conf: (2) Quik_Bas
On 05-10-92 EDDIE ROWE wrote to ALL...
ER> I'm trying to write a routine that will take a string from another
ER> program which converts everything to ALL CAPS back to a form that
ER> is more pleasing to the eye. This relys on the string having two
ER> components (in my case a FirstName LastName). Anyone have a pointer or
ER> two to share to clean this up so it can take however many different
ER> parts its needs and maybe a bit simpler?
Here's what I'm using, thanks to code from Zack Jones:
DECLARE FUNCTION FirstCap$ (Temp$)
Temp$ = "-> ZACK jones supplied the code to dO THIS."
FUNCTION FirstCap$ (Temp$)
Temp$ = LTRIM$(RTRIM$(Temp$))
IF Temp$ = "" THEN
Work$ = ""
NextWord% = 1
Index% = INSTR(NextWord%, Temp$, " ")
IF Index% <> 0 THEN
NowWord$ = MID$(Temp$, NextWord%, Index% - NextWord%)
NextWord% = Index% + 1
NowWord$ = MID$(Temp$, NextWord%)
NowWord$ = UCASE$(LEFT$(NowWord$, 1)) + LCASE$(MID$(NowWord$, 2))
IF Index% THEN NowWord$ = NowWord$ + " "
Work$ = Work$ + NowWord$
LOOP UNTIL Index% = 0
FirstCap$ = Work$
... OFFLINE 1.36 * Whatever is well conceived can be well expressed.
--- MsgToss 2.0c (r)
* Origin: JW-PC Consulting DataFlex.HST (608)837-1923 (1:121/8)