First Caps

 BBS: Inland Empire Archive
Date: 05-27-92 (07:59)             Number: 138
From: RANDY POOLE                  Refer#: NONE
  To: EDDIE ROWE                    Recvd: NO  
Subj: First Caps                     Conf: (2) Quik_Bas
I believeif what your looking for is a routine to
Capitalize the first letter of the word in a string
the following will do it..

p=
p2=1
lp=0
stp=0
dta$="mr jOHn CASEy JoneS"      'string containing the info to be altered
st$=""                          'temporary stroage string
dta$=UCASE$(dta$)               'convert string to upper case initially
DO UNTIL stp                    'loop until stp=1
  p=instr(lp+1,dta$," ")        'check for occurence of " " in dta$
  if p=0 then p=len(dta$):stp=1 'if no " " found set stp to 1 and end routine
  st$=mid$(dta$,lp+1,p-lp)      'capture the located word and store in st$
  st$=mid$(st$,1,1)+LCASE$(mid$(st$,2,len(st$)))
                                'Keep first character upper case and
                                'convert the rest to lower case
  mid$(dta$,lp+1,p-lp)=st$      'replace old word with new word
  lp=p                          'lp is the last special char occurence
LOOP



--- Maximus 2.01wb
 * Origin: /* Hacker's Haven */  Clearwater, FL  (813) 442-1441 (1:3603/160)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET