Hi,

Is there any VFP function or a subroutine that will properly format a
sentence ie. Only capitalizing the first words in a sentence. The
PROPER() function seems to capitalize all the words in a sentence.

Thanks

Zoom

Re: Any VFP function to properly format a sentence? by Man-wai

Man-wai
Tue Jun 26 08:45:45 CDT 2007

> Is there any VFP function or a subroutine that will properly format a
> sentence ie. Only capitalizing the first words in a sentence. The
> PROPER() function seems to capitalize all the words in a sentence.

Open a M$ Word session, pass the text to it, call it's formating
function, then suck the formatted text back?

http://www.google.com.hk/search?source=ig&hl=en&q=foxpro+format+paragraph&meta=&btnG=Google+Search


--
@~@ Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04) Linux 2.6.21.5
^ ^ 21:44:02 up 8 days 11:16 0 users load average: 0.00 0.02 0.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

Re: Any VFP function to properly format a sentence? by Man-wai

Man-wai
Tue Jun 26 08:50:36 CDT 2007

> Open a M$ Word session, pass the text to it, call it's formating
> function, then suck the formatted text back?
> http://www.google.com.hk/search?source=ig&hl=en&q=foxpro+format+paragraph&meta=&btnG=Google+Search

Or maybe using OpenOffice. They got scripting functions now.

--
@~@ Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
/ v \ Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Xubuntu 7.04) Linux 2.6.21.5
^ ^ 21:50:01 up 8 days 11:22 0 users load average: 0.00 0.00 0.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

Re: Any VFP function to properly format a sentence? by Olaf

Olaf
Tue Jun 26 09:07:52 CDT 2007

There are far more stumbling blocks in
formatting the upper lower case, for example
some abbreviations like "etc." have a point but
don't finish the sentence. In german and other
languages you also don't have only the first
letter of a sentence as capitol letter and even
in english names (of peple, places etc.) are
written with an upper case letter, in titles even
words normally not upper case are upper case.
This truly is word processing, not a vfp job.

And even word will not automagically format
sentences, it will just mark what it recognises
as errors.

To use spellchecking abilities from Word in VFP:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q271819&ID=KB;EN-US;Q271819

Bye, Olaf.



Re: Any VFP function to properly format a sentence? by Roger

Roger
Tue Jun 26 09:23:05 CDT 2007


"Zoom" <keashdoc@hotmail.com> wrote:

> Hi,
>
> Is there any VFP function or a subroutine that will properly format a
> sentence ie. Only capitalizing the first words in a sentence. The
> PROPER() function seems to capitalize all the words in a sentence.

What's your definition of a sentence?
Think about it.

-Roger





Re: Any VFP function to properly format a sentence? by Zoom

Zoom
Tue Jun 26 09:33:12 CDT 2007

I simply want the first word in the beginning of the text and after any
periods to be capitalized. The rest should all be lowercase.

Zoom


"Roger Ansell" <notmy@realemailaddress.net> wrote in message
news:%23ma1B0$tHHA.3796@TK2MSFTNGP02.phx.gbl...
>
> "Zoom" <keashdoc@hotmail.com> wrote:
>
>> Hi,
>>
>> Is there any VFP function or a subroutine that will properly format a
>> sentence ie. Only capitalizing the first words in a sentence. The
>> PROPER() function seems to capitalize all the words in a sentence.
>
> What's your definition of a sentence?
> Think about it.
>
> -Roger
>
>
>
>



Re: Any VFP function to properly format a sentence? by Josh

Josh
Tue Jun 26 10:11:28 CDT 2007

On Tue, 26 Jun 2007 09:33:12 -0500, "Zoom" <keashdoc@hotmail.com> wrote:

>I simply want the first word in the beginning of the text and after any
>periods to be capitalized. The rest should all be lowercase.


That's different than what I previously posted

just scan for a period; then captalize the next letter... you'll have to write
the function -- use at(), upper() and stuff()


>
>Zoom
>
>
>"Roger Ansell" <notmy@realemailaddress.net> wrote in message
>news:%23ma1B0$tHHA.3796@TK2MSFTNGP02.phx.gbl...
>>
>> "Zoom" <keashdoc@hotmail.com> wrote:
>>
>>> Hi,
>>>
>>> Is there any VFP function or a subroutine that will properly format a
>>> sentence ie. Only capitalizing the first words in a sentence. The
>>> PROPER() function seems to capitalize all the words in a sentence.
>>
>> What's your definition of a sentence?
>> Think about it.
>>
>> -Roger
>>
>>
>>
>>
>


Re: Any VFP function to properly format a sentence? by Josh

Josh
Tue Jun 26 10:11:28 CDT 2007

ummmm

function PropSentence
lparam tcSentence
return upper(left(tcSentence,1))+substr(tcSentence,2)
endfunc



On Tue, 26 Jun 2007 08:39:54 -0500, "Zoom" <keashdoc@hotmail.com> wrote:

>Hi,
>
>Is there any VFP function or a subroutine that will properly format a
>sentence ie. Only capitalizing the first words in a sentence. The
>PROPER() function seems to capitalize all the words in a sentence.
>
>Thanks
>
>Zoom
>


Re: Any VFP function to properly format a sentence? by Anders

Anders
Tue Jun 26 10:28:01 CDT 2007

s= ' this is a tst. and this is another. i want to change the first letter
of each sentence to uppercase'
s = LOWER(s)
s = UPPER(LEFT(LTRIM(s),1))+SUBSTR(LTRIM(s),2)
FOR i = ASC('a') TO ASC('z')
s= STRTRAN(s,'. '+CHR(i),'. '+CHR(i-32))
NEXT
? s
s= ' this is a test. and this is another. i want to change the first letter
of each sentence to uppercase'
s= LOWER(s)
s2=PROPER(GETWORDNUM(s,1))+SPACE(1)
FOR i = 2 TO GETWORDCOUNT(s)
w1=GETWORDNUM(s,i-1)
w2=GETWORDNUM(s,i)
s2=s2+IIF(RIGHT(w1,1)='.',PROPER(w2)+SPACE(1),w2+SPACE(1))
NEXT
? s2

-Anders


"Zoom" <keashdoc@hotmail.com> wrote in message
news:xu2dnVN7Qr01vhzbnZ2dnUVZ_tWhnZ2d@comcast.com...
>I simply want the first word in the beginning of the text and after any
>periods to be capitalized. The rest should all be lowercase.
>
> Zoom
>
>
> "Roger Ansell" <notmy@realemailaddress.net> wrote in message
> news:%23ma1B0$tHHA.3796@TK2MSFTNGP02.phx.gbl...
>>
>> "Zoom" <keashdoc@hotmail.com> wrote:
>>
>>> Hi,
>>>
>>> Is there any VFP function or a subroutine that will properly format a
>>> sentence ie. Only capitalizing the first words in a sentence. The
>>> PROPER() function seems to capitalize all the words in a sentence.
>>
>> What's your definition of a sentence?
>> Think about it.
>>
>> -Roger
>>
>>
>>
>>
>
>



Re: Any VFP function to properly format a sentence? by Gene

Gene
Tue Jun 26 10:32:11 CDT 2007

[reordered to chronological]

"Zoom" <keashdoc@hotmail.com> wrote:

>"Roger Ansell" <notmy@realemailaddress.net> wrote in message
>news:%23ma1B0$tHHA.3796@TK2MSFTNGP02.phx.gbl...
>>
>> "Zoom" <keashdoc@hotmail.com> wrote:

>>> Is there any VFP function or a subroutine that will properly format a
>>> sentence ie. Only capitalizing the first words in a sentence. The
>>> PROPER() function seems to capitalize all the words in a sentence.
>>
>> What's your definition of a sentence?
>> Think about it.

>I simply want the first word in the beginning of the text and after any
>periods to be capitalized. The rest should all be lowercase.

"properly format"? You need to think more on the matter. There
are minefields.

By your statement, this is one sentence: "How are you? I am
fine." since you are considering only periods are sentence delimiters.

Some words end with a period, but it is not the end of the
sentence. Consider "He lives on Ninth Ave. and works downtown."

First WORD? "Once upon a time" would become "ONCE upon a time"?

The rest should be lower case? "I live in Kamloops." would be
become "I live in kamloops." Kamloops is a proper noun.

Some words are spelled with a lower case starting character.
"dBASE" is one. This is also true of some names (de and von names,
for example). Some names have internal capital letters: "dBASE",
"WordStar", "McFie".

Some names differ only in capitalisation: "Mackie" and "MacKie"
are different names.

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: Any VFP function to properly format a sentence? by Roger

Roger
Tue Jun 26 10:38:26 CDT 2007


"Zoom" <keashdoc@hotmail.com> wrote:

>I simply want the first word in the beginning of the text and after any
>periods to be capitalized. The rest should all be lowercase.


Aha! That's not the same question as you as you originally posted.
Anyway ...

lcString = "hello world. please reformat me. job done."
lcDelim = "."
lcReformatted = ""
lnSentences = GetWordCount(lcString,lcDelim )
For i = 1 To lnSentences
lcSentence = GetWordNum(lcString,i,lcDelim )
For x = 1 To Len(lcSentence)
lcChar = Substr(lcSentence,x,1)
If ! Empty(lcChar)
lnFirstUCharPos = x
lcReformatted = lcReformatted + Upper(lcChar)
Exit
Else
lcReformatted = lcReformatted + lcChar
EndIf
Next
lcReformatted = lcReformatted + ;
Lower(Substr(lcSentence,lnFirstUCharPos + 1)) + ;
lcDelim
Next

?lcReformatted

>
>
> "Roger Ansell" <notmy@realemailaddress.net> wrote in message
> news:%23ma1B0$tHHA.3796@TK2MSFTNGP02.phx.gbl...
>>
>> "Zoom" <keashdoc@hotmail.com> wrote:
>>
>>> Hi,
>>>
>>> Is there any VFP function or a subroutine that will properly format
>>> a sentence ie. Only capitalizing the first words in a sentence.
>>> The PROPER() function seems to capitalize all the words in a
>>> sentence.
>>
>> What's your definition of a sentence?
>> Think about it.
>>
>> -Roger
>>
>>
>>
>>
>
>



Re: Any VFP function to properly format a sentence? by Paul

Paul
Tue Jun 26 11:28:53 CDT 2007


"Roger Ansell" <notmy@realemailaddress.net> wrote in message
news:%23ma1B0$tHHA.3796@TK2MSFTNGP02.phx.gbl...
>
> "Zoom" <keashdoc@hotmail.com> wrote:
>
>> Hi,
>>
>> Is there any VFP function or a subroutine that will properly format a
>> sentence ie. Only capitalizing the first words in a sentence. The
>> PROPER() function seems to capitalize all the words in a sentence.
>
> What's your definition of a sentence?
> Think about it.
>
> -Roger


What I want is a function to WRITE a sentence. Better yet, a whole book. A
best-seller.


"There are three rules for writing the novel. Unfortunately, no one knows
what they are."

- W. Somerset Maugham




Re: Any VFP function to properly format a sentence? by Dan

Dan
Tue Jun 26 13:40:13 CDT 2007

Paul Pedersen wrote:
> "Roger Ansell" <notmy@realemailaddress.net> wrote in message
> news:%23ma1B0$tHHA.3796@TK2MSFTNGP02.phx.gbl...
>>
>> "Zoom" <keashdoc@hotmail.com> wrote:
>>
>>> Hi,
>>>
>>> Is there any VFP function or a subroutine that will properly format
>>> a sentence ie. Only capitalizing the first words in a sentence. The
>>> PROPER() function seems to capitalize all the words in a
>>> sentence.
>>
>> What's your definition of a sentence?
>> Think about it.
>>
>> -Roger
>
>
> What I want is a function to WRITE a sentence. Better yet, a whole
> book. A best-seller.
>
>
> "There are three rules for writing the novel. Unfortunately, no one
> knows what they are."
>
> - W. Somerset Maugham

Ah... you're looking for MakeMeRich(). I hear that, and DWIM(), were slated
for VFP 11. ;-)

Dan



Re: Any VFP function to properly format a sentence? by Josh

Josh
Tue Jun 26 13:55:05 CDT 2007

That doesn't take into account many other factors

"this is a test of a paragraph. I wonder how it will work. <CR/LF>
this would be skipped. as would this, since there were two spaces"

On Tue, 26 Jun 2007 17:28:01 +0200, "Anders Altberg" <anders.altberg> wrote:

>s= ' this is a tst. and this is another. i want to change the first letter
>of each sentence to uppercase'
>s = LOWER(s)
>s = UPPER(LEFT(LTRIM(s),1))+SUBSTR(LTRIM(s),2)
>FOR i = ASC('a') TO ASC('z')
>s= STRTRAN(s,'. '+CHR(i),'. '+CHR(i-32))
>NEXT
>? s
>s= ' this is a test. and this is another. i want to change the first letter
>of each sentence to uppercase'
>s= LOWER(s)
>s2=PROPER(GETWORDNUM(s,1))+SPACE(1)
>FOR i = 2 TO GETWORDCOUNT(s)
>w1=GETWORDNUM(s,i-1)
>w2=GETWORDNUM(s,i)
>s2=s2+IIF(RIGHT(w1,1)='.',PROPER(w2)+SPACE(1),w2+SPACE(1))
>NEXT
>? s2
>
>-Anders
>
>
>"Zoom" <keashdoc@hotmail.com> wrote in message
>news:xu2dnVN7Qr01vhzbnZ2dnUVZ_tWhnZ2d@comcast.com...
>>I simply want the first word in the beginning of the text and after any
>>periods to be capitalized. The rest should all be lowercase.
>>
>> Zoom
>>
>>
>> "Roger Ansell" <notmy@realemailaddress.net> wrote in message
>> news:%23ma1B0$tHHA.3796@TK2MSFTNGP02.phx.gbl...
>>>
>>> "Zoom" <keashdoc@hotmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> Is there any VFP function or a subroutine that will properly format a
>>>> sentence ie. Only capitalizing the first words in a sentence. The
>>>> PROPER() function seems to capitalize all the words in a sentence.
>>>
>>> What's your definition of a sentence?
>>> Think about it.
>>>
>>> -Roger
>>>
>>>
>>>
>>>
>>
>>
>


Re: Any VFP function to properly format a sentence? by Josh

Josh
Tue Jun 26 13:55:05 CDT 2007

Nice.

On Wed, 27 Jun 2007 01:08:26 +0930, "Roger Ansell" <notmy@realemailaddress.net>
wrote:

>
>"Zoom" <keashdoc@hotmail.com> wrote:
>
>>I simply want the first word in the beginning of the text and after any
>>periods to be capitalized. The rest should all be lowercase.
>
>
>Aha! That's not the same question as you as you originally posted.
>Anyway ...
>
>lcString = "hello world. please reformat me. job done."
>lcDelim = "."
>lcReformatted = ""
>lnSentences = GetWordCount(lcString,lcDelim )
>For i = 1 To lnSentences
> lcSentence = GetWordNum(lcString,i,lcDelim )
> For x = 1 To Len(lcSentence)
> lcChar = Substr(lcSentence,x,1)
> If ! Empty(lcChar)
> lnFirstUCharPos = x
> lcReformatted = lcReformatted + Upper(lcChar)
> Exit
> Else
> lcReformatted = lcReformatted + lcChar
> EndIf
> Next
> lcReformatted = lcReformatted + ;
> Lower(Substr(lcSentence,lnFirstUCharPos + 1)) + ;
> lcDelim
>Next
>
>?lcReformatted
>
>>
>>
>> "Roger Ansell" <notmy@realemailaddress.net> wrote in message
>> news:%23ma1B0$tHHA.3796@TK2MSFTNGP02.phx.gbl...
>>>
>>> "Zoom" <keashdoc@hotmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> Is there any VFP function or a subroutine that will properly format
>>>> a sentence ie. Only capitalizing the first words in a sentence.
>>>> The PROPER() function seems to capitalize all the words in a
>>>> sentence.
>>>
>>> What's your definition of a sentence?
>>> Think about it.
>>>
>>> -Roger
>>>
>>>
>>>
>>>
>>
>>
>


Re: Any VFP function to properly format a sentence? by Josh

Josh
Tue Jun 26 13:55:06 CDT 2007

>Ah... you're looking for MakeMeRich(). I hear that, and DWIM(), were slated
>for VFP 11. ;-)
>


I hate to burst your bubble; but.. it will be in vfp10 and due to design of the
fuction, and a preview of the CTP help file; the function really should be
called
MakeBillGatesRich()

sadly; I hear the fuction is ultimately flawed and may delay or even kill the
release of vfp10


Re: Any VFP function to properly format a sentence? by Gene

Gene
Tue Jun 26 17:11:46 CDT 2007

"Dan Freeman" <spam@microsoft.com> wrote:

[snip]

>Ah... you're looking for MakeMeRich(). I hear that, and DWIM(), were slated
>for VFP 11. ;-)

Microsoft has stated that there will be no VFP 10. They have not
said that there would be no VFP 11. They have skipped version numbers
beFOUR.
set i_wish off

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: Any VFP function to properly format a sentence? by Rush

Rush
Tue Jun 26 21:18:20 CDT 2007

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Josh Assing wrote:
<blockquote cite="mid:55o283lpikmbahsmrgcdgi0chs637g9ut5@4ax.com"
type="cite">
<blockquote type="cite">
<pre wrap="">Ah... you're looking for MakeMeRich(). I hear that, and DWIM(), were slated
for VFP 11. ;-)

</pre>
</blockquote>
<pre wrap=""><!---->

I hate to burst your bubble; but.. it will be in vfp10 and due to design of the
fuction, and a preview of the CTP help file; the function really should be
called
MakeBillGatesRich()
</pre>
</blockquote>
<br>
Just a bit of sloppy coding; they hard coded the recipient instead of
allowing for a parameter.&nbsp; They're sure to fix it by version 12.<br>
<br>
&nbsp;- Rush<br>
</body>
</html>

Re: Any VFP function to properly format a sentence? by Gene

Gene
Tue Jun 26 21:30:58 CDT 2007

Rush Strong <rpstrong@gmail.com> wrote:

>Josh Assing wrote: Ah... you're looking for MakeMeRich(). I hear that, and DWIM(), were slated
>for VFP 11. ;-)

>I hate to burst your bubble; but.. it will be in vfp10 and due to design of the
>fuction, and a preview of the CTP help file; the function really should be
>called
>MakeBillGatesRich()
>
>Just a bit of sloppy coding; they hard coded the recipient instead of allowing for a parameter. They're sure to fix it by version 12.

It should be OO: person.makerich()

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.

Re: Any VFP function to properly format a sentence? by Roger

Roger
Wed Jun 27 01:28:20 CDT 2007


"Paul Pedersen" <nospam@no.spam> wrote:
>
>
> What I want is a function to WRITE a sentence. Better yet, a whole
> book. A best-seller.

See what happens around here when you post a perfectly reasonable
question?
You get flippant answers. Well, not from me! I've been working on
exactly
such a project. All you need is a table with lots of words and a program
to randomsnly generate sentences, paragraphs and chapters. The result,
although perhaps not syntactically or grammatically correct, can then be
manually edited to yield a truly unique work of er ... um ... literature
and at least every sentence starts with a capital letter and ends with
a period.

Here's the first few lines (unedited) of my latest work, as generated by
my little program. I think you'll agree that it has great potential.

My First Best Seller
By Roger Ansell
---------------
Peripatetic langley kaoliang saponins viscountess candied censoriously
alunite diastole percents sox ditcher expediter pucks haler. Advanced
duenna spaciously aventails asbestic metalists silty cembali kevils
quibblers nonparty martial nonrepresentative netless papa singly shnaps
reutter dicky exarchs outwinds poetising skiplane cineaste smiths unmask
pervaded semen pikers rhinoceros jennets forelands isatines bristlier
worker
fiberboards alighted. Endways refurbishes sheens egomania outrocked
crewel
inveterate historical captivation brawny purled sorgho renogram
missteered
continuing didymiums odorless primages unwinds autogyro increase.
Recolored
bussing persuasive stoai amitroles vittled magi spearheads ascensions
tumefied hallow striate heirdoms herculean mechanized upwardly mayweed
commove sorning counterpropagations fuehrer luncheons stichic doiled
damaged hypochondriac radiate teems inarms lash seldom toadyisms ta
tamarao
hooknoses limns janisary platoon. Unrig kathodes hypnotically watermelon
antibodies anatases sulfuric prism stuffs dights swaggering becarpeted
patines practising chimer wiggings tabbises germaniums oozily cates
acequia
kashas semipro exclusive childing cartridges incise lyricisms snooling
frizzler norias resample radioed rushing. Portiere retrievability
spunkiest
malaria impeaches croquettes presser skreighed limbered indignant
jubilated
pyrexias beaus moveable impotencies warp pigboat dissaving pewees
overreaction
olibanum feal chenille mangolds unvoices slumber coproprietorships
redemptions
shapely supplements muggers enisles stewardships heartily fulfills
erumpent
caves layering. Complained coagulating inhibitions disabilities scarify
inventive mahonias penitence specula gruntling facer cushiest assertions
hospodars caesural vigorousnesses overspreads cried replaces brunches
grogshop
stolidly sowing caserns bullock allays. Legislate boozy goings roque
nonsmoker
massacring trigged bulge shrapnel latency invincibilities rebuild.

... to be continued

-Roger





Re: Any VFP function to properly format a sentence? by Rush

Rush
Wed Jun 27 08:37:11 CDT 2007

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Roger Ansell wrote:
<blockquote cite="mid:uIIoaPIuHHA.536@TK2MSFTNGP06.phx.gbl" type="cite">
<pre wrap="">"Paul Pedersen" <a class="moz-txt-link-rfc2396E" href="mailto:nospam@no.spam">&lt;nospam@no.spam&gt;</a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
What I want is a function to WRITE a sentence. Better yet, a whole
book. A best-se