Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need some Improvement (STRTRAN Function)
Message
De
13/11/2017 12:19:15
 
 
À
13/11/2017 11:48:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01655516
Message ID:
01655552
Vues:
43
>
>
>Sir,
>Here is the File. How will I extract the Required Text at many instances and need to replace it with my Required Text.
>https://www.dropbox.com/s/p2ud6aknblqwxw3/123Data.txt?dl=0
>
>I am not able to get how I will Use STREXTRACT() for extracting String at Multiple places and Replace it, Else I am infact more comfortable with STREXTRACT()
>
>Thanks

[caution: the "less-than" signs may be not properly rendered inside the TEXT...ENDTEXT structure]
LOCAL Prefix AS String
LOCAL Postfix AS String
LOCAL ReplacedText AS String
LOCAL CurrentText AS String
LOCAL FileContents AS String

m.Prefix = '_123456789_123456789'
m.Postfix = "/MediaBox"

TEXT TO m.FileContents NOSHOW
!\x1f5\xec\xf2\xb01\x88\x0c\xa0\xa5\xb5\xe3\xc4\x89\x88\x0e]\x15\'\'K=\xe4\xacT\x1fD\xf6\xdf\xf1\xe3d\xf6
\xb9\xa6\xa7;9vR\x88Y\xe9\xdc\x83<\x12\xba2\x87@\xaf{X>\xfb\xbcz\xff\x0c\xbdX\x94\xb3\xa7\x0c\xf3\xf4\xa2
\x9c\x89}\xa5JE\x98\x05-S\x88\x8f\xdb\xc19\xf9=\xb13\xaa\x1f\xb3\xcf\xa2\x97\x9b\xa0\xfcvZ\xc6:\xe7\x1f\xf05y
\xc8}\xba\x97:6W5.\xc4\xc4:u\x98@{\\\x9b|\xa46\x14ZG\xfeay+_\x916\xd9\xcb\xaa\x05\xaeM\x18}\x97\x98f\xfb\x06
\xe0\x8fL\xbb\xfekD\x1en\xfd\xb7\xdf\xf4_\x07\xd4\x7fID\xfc\xf6\x90#\xbfS\xc35f\x8d)\x1e\xb6Y!\xae\xd8\x7f\xf5
\x99?\xb0\xf7\x9d\xff\xee0l\xee\xfd7\xfb\xec\xbe\x88\xe1\xfb\xe6\x7fm\xe5\xe3
\x90endstream endobj 18 0 obj 4227 endobj _123456789_123456789_123456789__ 0 R /MediaBox [0 0 595 842] /Rotate 0
/Resources 25 0 R /Contents 17 0 R >> endobj 25 0 obj <</ProcSet[/PDF /Text] /ExtGState 23 0 R /Font 24 0 R >> endobj 27 0 obj <<
/Length 28 0 R/Filter /FlateDecode>> stream\r\n\x0f\xa7~\x7f\x87y\xe1\xd9\x0c\x05\x96\x98@\xa0.\xf2\xc7\xea
\x8co\x19/~\xbch\x1a\xfa \x11C\xb3\x80\x9f\x9eN\xfa\xcb{\xb9\xf6\xf1\x1d\xf3\xb3b\x11}\x1c\x029\xfd\xcb\x0e@
\xf6J)"\x1e\xcb\xd8\xd3cx\xc3\xa3\x08\xfe\xfc\xc3O\xef/\xea\xf2\xe9GY\xd3\xfd\x9c\xedw\x97\xff\x03\xd8\xf4
\xb9\x8dendstream endobj 28 0 obj 4190 endobj _123456789_123456789_123456789__123456789__123456789__ 0 R /MediaBox [0 0 595 842] /Rotate 0
/Resources 31 0 R /Contents 27 0 R >> endobj 31 0 obj <</ProcSet[/PDF /Text] /ExtGState 29 0 R /Font 30 0 R >> endobj 33 0 obj <</Length 34 0 R
/Filter /FlateDecode>> stream\r\nx\x9c\xc5\x9dI\xb3\x1b\xb7\x11\x80\xef\xfe\x15<>\x1dD\xa17,\xbc\xc9K9J%\xae8~\xb7T\x0e\x8e"\xbb
\x92\x8a\xac\xb2c\'\x7f?\r\np\x86\x03\xcc\x0c8\x1b\xf8"/\xa2\x1e)\x12\xf3\xa1\xd9\xdd\xe8m~>\x993\xfb\x93
\x89\xff\xf4\x0f\xde\x7f<\xbd\xf9\xe2\xd7O\x1f\xed\xe9\xc7\x7f\xeb\x1f\xbf\xd6\xff~<\xfd|\xc2\xb3\xf1D\x94^
\x92?\xd6\x97\x7f\xfe\xfcY\xfa\x1b\x10N \xa7\xe7\x1fN\x90\x9e\x81\x13\xd8p\x96\xe0O\xde\xb8\xd3\xf3\xc7\xd3
\xd3\xe7\xbf{\xfb\xe7\xb7\xcf\xa7\xef\xde~\xf3\x85>:}\xf3\xee\xeb\xb7\x7f<\xfd\xe1\xdd\x1f\xdf=\x7f\xf5\xe5
\xab\xe7\x7f^?7\x9c|\xf1\x1ex\x0e!\xf0\xc9\xf9\x10\xdf\xe3/Oo\xdf\xbf\xff\xf4\xdbO\xbf\x9e\xbe\xf9\xed\xe3
\xdf>\xfcr\xd2_`\x0c\x13x\x08\xfe\xd5k@\xef\xe1\xe9\xddO\xff\xf9\xf4\x8f\xf7\x1fN_~\xff\xeb\x87\xf8\r\n\xc3o
\r\n\x0f\xa7~\x7f\x87y\xe1\xd9\x0c\x05\x96\x98@\xa0.\xf2\xc7\xea\x8co\x19/~\xbch\x1a\xfa \x11C\xb3\x80\x9f
\x9eN\xfa\xcb{\xb9\xf6\xf1\x1d\xf3\xb3b\x11}\x1c\x029\xfd\xcb\x0e@\xf6J)"\x1e\xcb\xd8\xd3cx\xc3\xa3\x08\xfe
\xfc\xc3O\xef/\xea\xf2\xe9GY\xd3\xfd\x9c\xedw\x97\xff\x03\xd8\xf4\xb9
\x8dendstream endobj 28 0 obj 4190 endobj _123456789_123456789_123456789__123456789__0 R /MediaBox [0 0 595 842] /Rotate 0
/Resources 31 0 R /Contents 27 0 R >> endobj 31 0 obj <</ProcSet[/PDF /Text] /ExtGState 29 0 R /Font 30 0 R >> endobj 33 0 obj <<
/Length 34 0 R/Filter /FlateDecode>> stream\r\nx\x9c\xc5\x9dI\xb3\x1b\xb7\x11\x80\xef\xfe\x15<>\x1dD\xa17,\xbc
\xc9K9J%\xae8~\xb7T\x0e\x8e"\xbb\x92\x8a\xac\xb2c\'\x7f?\r\np\x86\x03\xcc\x0c8\x1b\xf8"/\xa2\x1e)\x12\xf3\xa1
\xd9\xdd\xe8m~>\x993\xfb\x93\x89\xff\xf4\x0f\xde\x7f<\xbd\xf9\xe2\xd7O\x1f\xed\xe9\xc7\x7f\xeb\x1f\xbf\xd6
\xff~<\xfd|\xc2\xb3\xf1D\x94^\x92?\xd6\x97\x7f\xfe\xfcY\xfa\x1b\x10N \xa7\xe7\x1fN\x90\x9e\x81\x13\xd8p
\x96\xe0O\xde\xb8\xd3\xf3\xc7\xd3\xd3\xe7\xbf{\xfb\xe7\xb7\xcf\xa7\xef\xde~\xf3\x85>:}\xf3\xee\xeb
\xb7\x7f<\xfd\xe1\xdd\x1f\xdf=\x7f\xf5\xe5\xab\xe7\x7f^?7\x9c|\xf1\x1ex\x0e!\xf0\xc9\xf9\x10\xdf\xe3/Oo
\xdf\xbf\xff\xf4\xdbO\xbf\x9e\xbe\xf9\xed\xe3\xdf>\xfcr\xd2_`\x0c\x13x\x08\xfe\xd5k@\xef\xe1\xe9\xddO
\xff\xf9\xf4\x8f\xf7\x1fN_~\xff\xeb\x87\xf8\r\n\xc3o\r\n
ENDTEXT

m.FileContents = STRTRAN(m.FileContents, CHR(13) + CHR(10), "")

CLEAR
? "Unidentified jobs:", OCCURS(m.Prefix, m.FileContents)

CREATE CURSOR StringobjectNo (FObjectno Integer)

INSERT INTO StringobjectNo VALUES (1)
INSERT INTO StringobjectNo VALUES (2)
INSERT INTO StringobjectNo VALUES (3)

Select StringobjectNo
SCAN
	m.ReplacedText = ALLTRIM(STR(StringobjectNo.FObjectno)) + " 0 obj <</Type /Page /Parent 2 0 R " + m.Postfix
	m.CurrentText = STREXTRACT(m.FileContents, m.Prefix, m.Postfix, 1, 4)
	m.FileContents = STRTRAN(m.FileContents, m.CurrentText, m.ReplacedText, 1, 1)
ENDSCAN

?  "Unidentified jobs:", OCCURS(m.Prefix, m.FileContents)

* for you to check on a text editor
_cliptext = m.FileContents
----------------------------------
António Tavares Lopes
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform