Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word Wrap a Memo Field
Message
De
10/09/2002 10:06:53
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00698752
Message ID:
00698762
Vues:
13
This message has been marked as a message which has helped to the initial question of the thread.
>I need some help on a best (quickest) way to break a memo field down. Here is the scenario:
>
>I have to read in a set of characters into a memo field.
>Once they are in the memo field I need to break them every 75 characters with a Carriage Return Line Feed, but I don't want to break them on a word.
>I want to back down until I get to a space and then put in the carriage return line feed.
>
>So does anyone have a code solution that would quickly do this as I am dealing with a large amount of data.
>
>TIA

How about:



lcText = MyMemo
lnPos = 75
lnSpaces = 0


DO WHILE lnPos < LEN( lcText)
*-- Find the position of the space nearest to lnpos
*-- Step 1 get the number of spaces between the start and lnPos
lnSpaces = OCCURS( " ", LEFT( lcText, lnPos))

*-- Step2 Find the position of the space
lnPos = ATC( " ", lcText, lnSpaces)

*-- Insert a CRLF after the space
lcText = STUFF( lcText, lnPos + 1, 0, CRLF)

lnPos = lnPos + 75
ENDDO

REPLACE NEXT 1 MyMemo WITH lcText

<\pre>

Mace
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform