top of page
Rechercher

Tip 7 #4D Write Pro - Chercher/Remplacer

Dernière mise à jour : 24 juin 2019

Voici un petit bout de code qui vous permet de chercher et remplacer une chaine de texte par une autre dans un document Write Pro.


Dans le code, veuillez penser à remplacer Form.WPObj, Form.search et Form.replace:


Code pour le Chercher/Remplace dans un document Write Pro

C_OBJECT($find)

$length:=0


// Find

$allText:=WP Get text(Form.WPObj)

$pos:=0

$find_col:=New collection

Repeat

$pos:=Position(Form.search;$allText;$pos+1;$length)

If ($pos>0)

$find_col.push(New object("pos";$pos;"length";$length))

End if

Until ($pos=0)


// Replace

For ($i;$find_col.length-1;0;-1)

$find:=$find_col[$i]

$range:=WP Text range(Form.WPObj;$find.pos;$find.pos+$find.length)

WP SET TEXT($range;Form.replace;wk replace)

End for


384 vues0 commentaire

Posts récents

Voir tout

List of 4D Components and Plugins

I realize that there is no list of existing components and plugins in 4D. I think it can be cool to make such kind of list to try to have a kind of catalog where people can look at to see what is avai

bottom of page