Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert UpperCase to Sentence?
Message
From
20/11/2012 04:14:12
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
19/11/2012 20:07:00
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01557608
Message ID:
01557624
Views:
68
>
lcText = "THIS IS A SAMPLE.  SENTENCE STRUCTURE."
>? lcText
>llCapital = .t.
>FOR lnI = 1 to LEN(lcText)
>    lcChar = SUBSTR(lcText, lnI, 1)
>    DO CASE
>        CASE lcChar = SPACE(1)
>            * Do nothing
>        OTHERWISE
>            lcText = STUFF(lcText, lnI, 1, IIF(llCapital, UPPER(lcChar), LOWER(lcChar)))
>            llCapital = (lcChar $ ".?!")
>    ENDCASE
>NEXT
>? lcText
In the end, you'll have about 50 cases in there, to satisfy the one rule of capitalization in english capitalism language ("there are no rules, we have lists"). First, you need to capitalize the solo i, then the days of the week, then sometimes months (but you May run into trouble on that March) and an occasional moon, plus the need to distinguish between Mercury in orbit and mercury in a thermometer. Then the oddities like dutch last names with the article or prefix remaining lowercase, like deVries, or things like O'Keefe but not O'Clock. Then there are mentions of vi editor (always lower case) and the roman VI numeral (always upper). And there'll be more.

Congratulations, you're well on your way of writing the first AI in VFP :).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform