Post Reply 
Replica a number
02-08-2022, 12:50 PM
Post: #9
RE: Replica a number
(02-08-2022 11:34 AM)Tyann Wrote:  Bonjour
Ces 2 solutions parcourent toute la liste des valeurs, sur de grandes listes où il y a peu de valeurs à remplacer cela peut prendre du temps inutilement.
Il y a une autre solution qui consiste à rechercher les valeurs à remplacer puis à arrêter quand il n'y on a plus.
A tester !

Hello
These 2 solutions go through the whole list of values, on big lists where there are few values to replace it can take time unnecessarily.
There is another solution which consists in searching for the values to replace and then stop when there are no more.
To be tested!

Code:

EXPORT LCHG(l,a,n)
//Liste,élément,élément
BEGIN
LOCAL i;
REPEAT 
 i:=POS(l,a);
 IF i THEN
  l(i):=n;
 END;
UNTIL i==0;
l;
END;

Excellent "code": very fast.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Replica a number - robmio - 02-03-2022, 10:16 AM
RE: Replica a number - robmio - 02-03-2022, 10:20 AM
RE: Replica a number - robmio - 02-03-2022, 02:04 PM
RE: Replica a number - Didier Lachieze - 02-03-2022, 01:43 PM
RE: Replica a number - robmio - 02-03-2022, 02:07 PM
RE: Replica a number - Arno K - 02-03-2022, 01:52 PM
RE: Replica a number - robmio - 02-03-2022, 02:10 PM
RE: Replica a number - Tyann - 02-08-2022, 11:34 AM
RE: Replica a number - robmio - 02-08-2022 12:50 PM



User(s) browsing this thread: 1 Guest(s)