This should be easy but somehow I don't get it,
in this example only the first occurrence of test should
be replaced with pot but it isn't
If I nstart = 0 then it goes well,
but I can't do it because if I only want the last
word to be replaced it won't.

so can somebody explain me way or how to ?
thanks in advance
regards
christophe

origfield = "dit is een test en dit is ook een test"
nstart = 12
curword = "test"
newword = "pot"
? STRTRAN(origfield,curword,newword,nstart)

Re: strtran() how to by Andrew

Andrew
Tue Oct 26 09:03:19 CDT 2004

christophe wrote:
> This should be easy but somehow I don't get it,
> in this example only the first occurrence of test should
> be replaced with pot but it isn't
> If I nstart = 0 then it goes well,
> but I can't do it because if I only want the last
> word to be replaced it won't.
>
> so can somebody explain me way or how to ?

nstart is the number of the occurrence of the word to change. There is
another optional parameter for how many replacements you want to change so I
think you want something like

origfield = "dit is een test en dit is ook een test"
nstart = 1
nrepcount = 1
curword = "test"
newword = "pot"
? STRTRAN(origfield,curword,newword,nstart,nrepcount)

--
HTH
Andrew Howell



Re: strtran() how to by christophe

christophe
Tue Oct 26 09:24:56 CDT 2004

oh,
I see it know,
I thought it was a position where it should start
replacing.
Then I am in trouble because I don't really know
which occurence. I only know a position.
This code is part of a translation of dutch text to english.
so for this example if I want to replace the last test
the first test can be replace are may be not replaced,
it depends on what the user selects.
The only thing I now is which position it is "translating" or
how far the translation is, regardsless of what is already translated
and especaily regardless of the translated contents
so I can't check which noccurence to translate.

any idea on how to solve this ?

regards
christophe


"Andrew Howell" <ajh@work> schreef in bericht
news:eQBWOS2uEHA.2860@TK2MSFTNGP11.phx.gbl...
> christophe wrote:
> > This should be easy but somehow I don't get it,
> > in this example only the first occurrence of test should
> > be replaced with pot but it isn't
> > If I nstart = 0 then it goes well,
> > but I can't do it because if I only want the last
> > word to be replaced it won't.
> >
> > so can somebody explain me way or how to ?
>
> nstart is the number of the occurrence of the word to change. There is
> another optional parameter for how many replacements you want to change so
I
> think you want something like
>
> origfield = "dit is een test en dit is ook een test"
> nstart = 1
> nrepcount = 1
> curword = "test"
> newword = "pot"
> ? STRTRAN(origfield,curword,newword,nstart,nrepcount)
>
> --
> HTH
> Andrew Howell
>
>



Re: strtran() how to by Andrew

Andrew
Tue Oct 26 09:41:31 CDT 2004

christophe wrote:
> oh,
> I see it know,
> I thought it was a position where it should start
> replacing.
> Then I am in trouble because I don't really know
> which occurence. I only know a position.
> This code is part of a translation of dutch text to english.

A product called "Systran" is your friend ;)
[I just translated 65 pages of English->Dutch with this..]

> so for this example if I want to replace the last test
> the first test can be replace are may be not replaced,
> it depends on what the user selects.
> The only thing I now is which position it is "translating" or
> how far the translation is, regardsless of what is already translated
> and especaily regardless of the translated contents
> so I can't check which noccurence to translate.
>
> any idea on how to solve this ?

I think combined with SUBSTR, LEFT etc. you should still be OK.

********
origfield = "dit is een test en dit is ook een test"
nstart = 12
curword = "test"
newword = "pot"
? LEFT(origfield,nstart-1)+STRTRAN(SUBSTR(origfield,nstart),curword,newword)
********

Try it with nstart=12, then nstart=13.

--
HTH
Andrew Howell



Re: strtran() how to by christophe

christophe
Tue Oct 26 09:48:25 CDT 2004

Systran ?
I know the product a little bit,
(got an evaluation, works great)
but my client want it fully integrated in my app
and call it from almost each textbox.
and as far as i know its not possible
or isn't it ?

regards
christophe
btw. I got it working know with Stuff()

"Andrew Howell" <ajh@work> schreef in bericht
news:%23ScBln2uEHA.452@TK2MSFTNGP09.phx.gbl...
> christophe wrote:
> > oh,
> > I see it know,
> > I thought it was a position where it should start
> > replacing.
> > Then I am in trouble because I don't really know
> > which occurence. I only know a position.
> > This code is part of a translation of dutch text to english.
>
> A product called "Systran" is your friend ;)
> [I just translated 65 pages of English->Dutch with this..]
>
> > so for this example if I want to replace the last test
> > the first test can be replace are may be not replaced,
> > it depends on what the user selects.
> > The only thing I now is which position it is "translating" or
> > how far the translation is, regardsless of what is already translated
> > and especaily regardless of the translated contents
> > so I can't check which noccurence to translate.
> >
> > any idea on how to solve this ?
>
> I think combined with SUBSTR, LEFT etc. you should still be OK.
>
> ********
> origfield = "dit is een test en dit is ook een test"
> nstart = 12
> curword = "test"
> newword = "pot"
> ?
LEFT(origfield,nstart-1)+STRTRAN(SUBSTR(origfield,nstart),curword,newword)
> ********
>
> Try it with nstart=12, then nstart=13.
>
> --
> HTH
> Andrew Howell
>
>



Re: strtran() how to by Fred

Fred
Tue Oct 26 09:53:42 CDT 2004

Then you need to use the STUFF() command if you know the position.

? STUFF(origfield,nStart,4,"pot")

--
Fred
Microsoft Visual FoxPro MVP


"christophe" <irs.znospamforme@skynet.be> wrote in message
news:OaH3Ye2uEHA.1452@TK2MSFTNGP11.phx.gbl...
> oh,
> I see it know,
> I thought it was a position where it should start
> replacing.
> Then I am in trouble because I don't really know
> which occurence. I only know a position.
> This code is part of a translation of dutch text to english.
> so for this example if I want to replace the last test
> the first test can be replace are may be not replaced,
> it depends on what the user selects.
> The only thing I now is which position it is "translating" or
> how far the translation is, regardsless of what is already translated
> and especaily regardless of the translated contents
> so I can't check which noccurence to translate.
>
> any idea on how to solve this ?
>
> regards
> christophe
>
>
> "Andrew Howell" <ajh@work> schreef in bericht
> news:eQBWOS2uEHA.2860@TK2MSFTNGP11.phx.gbl...
>> christophe wrote:
>> > This should be easy but somehow I don't get it,
>> > in this example only the first occurrence of test should
>> > be replaced with pot but it isn't
>> > If I nstart = 0 then it goes well,
>> > but I can't do it because if I only want the last
>> > word to be replaced it won't.
>> >
>> > so can somebody explain me way or how to ?
>>
>> nstart is the number of the occurrence of the word to change. There is
>> another optional parameter for how many replacements you want to change
>> so
> I
>> think you want something like
>>
>> origfield = "dit is een test en dit is ook een test"
>> nstart = 1
>> nrepcount = 1
>> curword = "test"
>> newword = "pot"
>> ? STRTRAN(origfield,curword,newword,nstart,nrepcount)
>>
>> --
>> HTH
>> Andrew Howell
>>
>>
>
>



RE: strtran() how to by Joe

Joe
Tue Oct 26 09:59:02 CDT 2004

I sincerely apologize for using your forum --- for some reason I cannot
originate a new thread (I get very short popup blockedmessage)but can reply
to an existing one

I am importing a text file with a date of mm/dd/yy into vfp7 --- the
resulting dates of birth are about 50% in error & in fact show furure dates
ie: 10/12/2046

Can someone help me figure out how to originate a new thread -- so I can
discuss this in an appropriate forum

I REALLY APOLOGIZE FOR NEEDING TO DO THIS!
Joe Robison

Re: strtran() how to by frederic

frederic
Tue Oct 26 10:13:49 CDT 2004

Bonjour Joe

as for a start, while waiting for a better day, you could use the MS HTML
newsgroup interface

http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.fox.programmer.exchange

or if it's the way you're doing it now, use the OE interface

news://msnews.microsoft.com/microsoft.public.programmer.exchange

HTH

Fred
PS:meanwhile, MS servers seem offline for an hour

Pour mémoire, tu nous as écrit :

> I sincerely apologize for using your forum --- for some reason I cannot
> originate a new thread (I get very short popup blockedmessage)but can
reply
> to an existing one
>
> I am importing a text file with a date of mm/dd/yy into vfp7 --- the
> resulting dates of birth are about 50% in error & in fact show furure
dates
> ie: 10/12/2046
>
> Can someone help me figure out how to originate a new thread -- so I can
> discuss this in an appropriate forum
>
> I REALLY APOLOGIZE FOR NEEDING TO DO THIS!
> Joe Robison


Re: strtran() how to by Andrew

Andrew
Tue Oct 26 10:35:16 CDT 2004

christophe wrote:
> Systran ?
> I know the product a little bit,
> (got an evaluation, works great)
> but my client want it fully integrated in my app
> and call it from almost each textbox.
> and as far as i know its not possible
> or isn't it ?

I just used its "active clipboard" feature - in which case, highlight the
text in whatever app, then ctrl+c to copy, ctrl+v to paste the translated
text on top. I don't know how well you can use the product's functionality
programmatically (if at all.)

--
Regards
Andrew Howell



Re: strtran() how to by christophe

christophe
Wed Oct 27 05:07:57 CDT 2004

hum, that seems to be a hole in the market...
thanks Andrew

regards
christophe
"Andrew Howell" <ajh@work> schreef in bericht
news:OEyO0F3uEHA.1376@TK2MSFTNGP10.phx.gbl...
> christophe wrote:
> > Systran ?
> > I know the product a little bit,
> > (got an evaluation, works great)
> > but my client want it fully integrated in my app
> > and call it from almost each textbox.
> > and as far as i know its not possible
> > or isn't it ?
>
> I just used its "active clipboard" feature - in which case, highlight the
> text in whatever app, then ctrl+c to copy, ctrl+v to paste the translated
> text on top. I don't know how well you can use the product's functionality
> programmatically (if at all.)
>
> --
> Regards
> Andrew Howell
>
>



Re: strtran() how to by christophe

christophe
Wed Oct 27 05:05:34 CDT 2004

Thanks Fred,

While reading Andrews post,
I reallised I misunderstood the nOccurence
of StrTran() and found Stuff to be better

regards
christophe

"Fred Taylor" <ftaylor@mvps.org!REMOVE> schreef in bericht
news:O27Ndu2uEHA.3416@TK2MSFTNGP09.phx.gbl...
> Then you need to use the STUFF() command if you know the position.
>
> ? STUFF(origfield,nStart,4,"pot")
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "christophe" <irs.znospamforme@skynet.be> wrote in message
> news:OaH3Ye2uEHA.1452@TK2MSFTNGP11.phx.gbl...
> > oh,
> > I see it know,
> > I thought it was a position where it should start
> > replacing.
> > Then I am in trouble because I don't really know
> > which occurence. I only know a position.
> > This code is part of a translation of dutch text to english.
> > so for this example if I want to replace the last test
> > the first test can be replace are may be not replaced,
> > it depends on what the user selects.
> > The only thing I now is which position it is "translating" or
> > how far the translation is, regardsless of what is already translated
> > and especaily regardless of the translated contents
> > so I can't check which noccurence to translate.
> >
> > any idea on how to solve this ?
> >
> > regards
> > christophe
> >
> >
> > "Andrew Howell" <ajh@work> schreef in bericht
> > news:eQBWOS2uEHA.2860@TK2MSFTNGP11.phx.gbl...
> >> christophe wrote:
> >> > This should be easy but somehow I don't get it,
> >> > in this example only the first occurrence of test should
> >> > be replaced with pot but it isn't
> >> > If I nstart = 0 then it goes well,
> >> > but I can't do it because if I only want the last
> >> > word to be replaced it won't.
> >> >
> >> > so can somebody explain me way or how to ?
> >>
> >> nstart is the number of the occurrence of the word to change. There is
> >> another optional parameter for how many replacements you want to change
> >> so
> > I
> >> think you want something like
> >>
> >> origfield = "dit is een test en dit is ook een test"
> >> nstart = 1
> >> nrepcount = 1
> >> curword = "test"
> >> newword = "pot"
> >> ? STRTRAN(origfield,curword,newword,nstart,nrepcount)
> >>
> >> --
> >> HTH
> >> Andrew Howell
> >>
> >>
> >
> >
>
>



Re: strtran() how to by Anders

Anders
Wed Oct 27 06:07:20 CDT 2004

Would GETWORDNUM() help? STUFF( ) works by position.
-Anders

"christophe" <irs.znospamforme@skynet.be> wrote in message
news:OaH3Ye2uEHA.1452@TK2MSFTNGP11.phx.gbl...
> oh,
> I see it know,
> I thought it was a position where it should start
> replacing.
> Then I am in trouble because I don't really know
> which occurence. I only know a position.
> This code is part of a translation of dutch text to english.
> so for this example if I want to replace the last test
> the first test can be replace are may be not replaced,
> it depends on what the user selects.
> The only thing I now is which position it is "translating" or
> how far the translation is, regardsless of what is already translated
> and especaily regardless of the translated contents
> so I can't check which noccurence to translate.
>
> any idea on how to solve this ?
>
> regards
> christophe
>
>
> "Andrew Howell" <ajh@work> schreef in bericht
> news:eQBWOS2uEHA.2860@TK2MSFTNGP11.phx.gbl...
> > christophe wrote:
> > > This should be easy but somehow I don't get it,
> > > in this example only the first occurrence of test should
> > > be replaced with pot but it isn't
> > > If I nstart = 0 then it goes well,
> > > but I can't do it because if I only want the last
> > > word to be replaced it won't.
> > >
> > > so can somebody explain me way or how to ?
> >
> > nstart is the number of the occurrence of the word to change. There is
> > another optional parameter for how many replacements you want to change
so
> I
> > think you want something like
> >
> > origfield = "dit is een test en dit is ook een test"
> > nstart = 1
> > nrepcount = 1
> > curword = "test"
> > newword = "pot"
> > ? STRTRAN(origfield,curword,newword,nstart,nrepcount)
> >
> > --
> > HTH
> > Andrew Howell
> >
> >
>
>


Re: strtran() how to by Anders

Anders
Wed Oct 27 06:19:44 CDT 2004

Hi Joe
Given this text file
12/21/67
1/10/99
07/31/00
11/1/04
11/1/05

CREATE CURSOR xx (dob D)
SET DATE MDY
SET CENTURY ON
SET CENTURY TO 19 ROLLOVER 04
APPEND FROM file DELIMITED
gives
Date
12/21/1967
01/10/1999
07/31/2000
11/01/1904
11/01/1905

-Anders

"Joe Robison" <Joe Robison@discussions.microsoft.com> wrote in message
news:F6A30326-3C58-48E3-B83A-13F9D1FF2C2E@microsoft.com...
> I sincerely apologize for using your forum --- for some reason I cannot
> originate a new thread (I get very short popup blockedmessage)but can
reply
> to an existing one
>
> I am importing a text file with a date of mm/dd/yy into vfp7 --- the
> resulting dates of birth are about 50% in error & in fact show furure
dates
> ie: 10/12/2046
>
> Can someone help me figure out how to originate a new thread -- so I can
> discuss this in an appropriate forum
>
> I REALLY APOLOGIZE FOR NEEDING TO DO THIS!
> Joe Robison


Re: strtran() how to by christophe

christophe
Wed Oct 27 08:10:15 CDT 2004

Not really,
Stuff works great now.

I had already tried Stuff() but "forgot"
that the nposition of the translated word in my app was at the
end of the word and not at the beginning so it replaced nothing...
and I also didn't read the helpfile of Strtran() not very well ...
(it wasn't my day :-(
anyway thanks for mentioning it

regards
christophe


"Anders Altberg" <x_pragma@telia.com> schreef in bericht
news:%23K3zsbBvEHA.2288@TK2MSFTNGP09.phx.gbl...
> Would GETWORDNUM() help? STUFF( ) works by position.
> -Anders
>
> "christophe" <irs.znospamforme@skynet.be> wrote in message
> news:OaH3Ye2uEHA.1452@TK2MSFTNGP11.phx.gbl...
> > oh,
> > I see it know,
> > I thought it was a position where it should start
> > replacing.
> > Then I am in trouble because I don't really know
> > which occurence. I only know a position.
> > This code is part of a translation of dutch text to english.
> > so for this example if I want to replace the last test
> > the first test can be replace are may be not replaced,
> > it depends on what the user selects.
> > The only thing I now is which position it is "translating" or
> > how far the translation is, regardsless of what is already translated
> > and especaily regardless of the translated contents
> > so I can't check which noccurence to translate.
> >
> > any idea on how to solve this ?
> >
> > regards
> > christophe
> >
> >
> > "Andrew Howell" <ajh@work> schreef in bericht
> > news:eQBWOS2uEHA.2860@TK2MSFTNGP11.phx.gbl...
> > > christophe wrote:
> > > > This should be easy but somehow I don't get it,
> > > > in this example only the first occurrence of test should
> > > > be replaced with pot but it isn't
> > > > If I nstart = 0 then it goes well,
> > > > but I can't do it because if I only want the last
> > > > word to be replaced it won't.
> > > >
> > > > so can somebody explain me way or how to ?
> > >
> > > nstart is the number of the occurrence of the word to change. There is
> > > another optional parameter for how many replacements you want to
change
> so
> > I
> > > think you want something like
> > >
> > > origfield = "dit is een test en dit is ook een test"
> > > nstart = 1
> > > nrepcount = 1
> > > curword = "test"
> > > newword = "pot"
> > > ? STRTRAN(origfield,curword,newword,nstart,nrepcount)
> > >
> > > --
> > > HTH
> > > Andrew Howell
> > >
> > >
> >
> >
>



Re: strtran() how to by JoeRobison

JoeRobison
Wed Oct 27 09:11:07 CDT 2004

Therin lies the issue -- if you look at the last 2 --- 1904 & 1905 --- any
dates up to the date of processing need t o be 2004 dates ---- I have tried
the set century to with a rollover & cannot make it work
BIG THANKS
Joe

"Anders Altberg" wrote:

> Hi Joe
> Given this text file
> 12/21/67
> 1/10/99
> 07/31/00
> 11/1/04
> 11/1/05
>
> CREATE CURSOR xx (dob D)
> SET DATE MDY
> SET CENTURY ON
> SET CENTURY TO 19 ROLLOVER 04
> APPEND FROM file DELIMITED
> gives
> Date
> 12/21/1967
> 01/10/1999
> 07/31/2000
> 11/01/1904
> 11/01/1905
>
> -Anders
>
> "Joe Robison" <Joe Robison@discussions.microsoft.com> wrote in message
> news:F6A30326-3C58-48E3-B83A-13F9D1FF2C2E@microsoft.com...
> > I sincerely apologize for using your forum --- for some reason I cannot
> > originate a new thread (I get very short popup blockedmessage)but can
> reply
> > to an existing one
> >
> > I am importing a text file with a date of mm/dd/yy into vfp7 --- the
> > resulting dates of birth are about 50% in error & in fact show furure
> dates
> > ie: 10/12/2046
> >
> > Can someone help me figure out how to originate a new thread -- so I can
> > discuss this in an appropriate forum
> >
> > I REALLY APOLOGIZE FOR NEEDING TO DO THIS!
> > Joe Robison
>
>

Re: strtran() how to by Anders

Anders
Wed Oct 27 09:53:06 CDT 2004

If 00, 01, 020 ,03 and 04 dates need to be set to this century
SET CENTURY TO 19 ROLLOVER 05
If you get a 05 year it would be set to 1905; a 99-year-old is not
impossible.
Dates from 05 to 99 would be set 1900+
-Anders


"Joe Robison" <JoeRobison@discussions.microsoft.com> wrote in message
news:3427C8E8-2FD7-43EE-9CB5-B860083F65AF@microsoft.com...
> Therin lies the issue -- if you look at the last 2 --- 1904 & 1905 ---
any
> dates up to the date of processing need t o be 2004 dates ---- I have
tried
> the set century to with a rollover & cannot make it work
> BIG THANKS
> Joe
>
> "Anders Altberg" wrote:
>
> > Hi Joe
> > Given this text file
> > 12/21/67
> > 1/10/99
> > 07/31/00
> > 11/1/04
> > 11/1/05
> >
> > CREATE CURSOR xx (dob D)
> > SET DATE MDY
> > SET CENTURY ON
> > SET CENTURY TO 19 ROLLOVER 04
> > APPEND FROM file DELIMITED
> > gives
> > Date
> > 12/21/1967
> > 01/10/1999
> > 07/31/2000
> > 11/01/1904
> > 11/01/1905
> >
> > -Anders
> >
> > "Joe Robison" <Joe Robison@discussions.microsoft.com> wrote in message
> > news:F6A30326-3C58-48E3-B83A-13F9D1FF2C2E@microsoft.com...
> > > I sincerely apologize for using your forum --- for some reason I
cannot
> > > originate a new thread (I get very short popup blockedmessage)but can
> > reply
> > > to an existing one
> > >
> > > I am importing a text file with a date of mm/dd/yy into vfp7 --- the
> > > resulting dates of birth are about 50% in error & in fact show furure
> > dates
> > > ie: 10/12/2046
> > >
> > > Can someone help me figure out how to originate a new thread -- so I
can
> > > discuss this in an appropriate forum
> > >
> > > I REALLY APOLOGIZE FOR NEEDING TO DO THIS!
> > > Joe Robison
> >
> >


Re: strtran() how to by JoeRobison

JoeRobison
Wed Oct 27 11:59:04 CDT 2004

THANK YOU!!!
Joe
"Anders Altberg" wrote:

> If 00, 01, 020 ,03 and 04 dates need to be set to this century
> SET CENTURY TO 19 ROLLOVER 05
> If you get a 05 year it would be set to 1905; a 99-year-old is not
> impossible.
> Dates from 05 to 99 would be set 1900+
> -Anders
>
>
> "Joe Robison" <JoeRobison@discussions.microsoft.com> wrote in message
> news:3427C8E8-2FD7-43EE-9CB5-B860083F65AF@microsoft.com...
> > Therin lies the issue -- if you look at the last 2 --- 1904 & 1905 ---
> any
> > dates up to the date of processing need t o be 2004 dates ---- I have
> tried
> > the set century to with a rollover & cannot make it work
> > BIG THANKS
> > Joe
> >
> > "Anders Altberg" wrote:
> >
> > > Hi Joe
> > > Given this text file
> > > 12/21/67
> > > 1/10/99
> > > 07/31/00
> > > 11/1/04
> > > 11/1/05
> > >
> > > CREATE CURSOR xx (dob D)
> > > SET DATE MDY
> > > SET CENTURY ON
> > > SET CENTURY TO 19 ROLLOVER 04
> > > APPEND FROM file DELIMITED
> > > gives
> > > Date
> > > 12/21/1967
> > > 01/10/1999
> > > 07/31/2000
> > > 11/01/1904
> > > 11/01/1905
> > >
> > > -Anders
> > >
> > > "Joe Robison" <Joe Robison@discussions.microsoft.com> wrote in message
> > > news:F6A30326-3C58-48E3-B83A-13F9D1FF2C2E@microsoft.com...
> > > > I sincerely apologize for using your forum --- for some reason I
> cannot
> > > > originate a new thread (I get very short popup blockedmessage)but can
> > > reply
> > > > to an existing one
> > > >
> > > > I am importing a text file with a date of mm/dd/yy into vfp7 --- the
> > > > resulting dates of birth are about 50% in error & in fact show furure
> > > dates
> > > > ie: 10/12/2046
> > > >
> > > > Can someone help me figure out how to originate a new thread -- so I
> can
> > > > discuss this in an appropriate forum
> > > >
> > > > I REALLY APOLOGIZE FOR NEEDING TO DO THIS!
> > > > Joe Robison
> > >
> > >
>
>