Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Separate the strings
Message
De
25/03/2016 11:58:25
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
À
25/03/2016 11:36:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01633712
Message ID:
01633749
Vues:
68
Yousfi,

it's about the general approach.
If stuff is done in VFP via loops and single VFP operations it is general slower than an inbuild operation. This is due to the design of VFP language.
So if you can use a inbuild operation, do it.
Also the use of a single operation is less prone to error.

MEMLINES() and the functions around it are dead as the dodo. I can do the same via FGET() and AT() and SUBSTR() and so one, or reinvent AT() via loop and SUBSTR(), or write a c dll, but this is pointless.

Also MEMLINE() as a big pain, because it depends on SET MEMOWIDTH. It will be no problem with such small strings, but you need to think in general.
lvMemo= SET("Memowidth")
SET MEMOWIDTH TO 8
LOCAL m.accounts,m.x
m.accounts='100,1100,200,250,3000,123456789,Just some other string'
m.accounts=STRTRAN(m.accounts,',',CHR(13))

m.x=""
FOR i=1 TO MEMLINES(m.accounts)
 m.x=m.x+"Accounts["+TRANS(i)+"]="+MLINE(m.accounts,i)+CHR(13)
ENDFOR
_CLIPTEXT = m.x
SET MEMOWIDTH TO (lvMemo)

MESSAGEBOX(m.x,"string in clipboard")
Default is 50 and I have seen enough errors using MEMLINES() in the days of yore. Forget about it. It's pointless.

Off Topic:
If you like to store something to the clipboard, the variable is _cliptext not _clipboard

>Hi Tamar
>*speed is important when the string is big and yes in this case it more slow.
> But here its a small string and there is no diffrence.
>*this is another solution:
>
>local m.accounts,m.x
>m.accounts='100,1100,200,250,3000'
>m.accounts=strtran(m.accounts,',',chr(13))
>
>m.x=""
>for i=1 to memlines(m.accounts)
>m.x=m.x+"Accounts["+trans(i)+"]="+mline(m.accounts,i)+chr(13)
>endfor
>_clipboard=m.x
>messagebox(m.x,"string in clipboard")
>
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform