Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert UpperCase to Sentence?
Message
De
20/11/2012 04:14:12
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
19/11/2012 20:07:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01557608
Message ID:
01557624
Vues:
70
>
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform