Even better. With Match regex it takes about a second to remove a smaller number of characters ($text;32;126;9;13) from this file. However, when few characters are selected to remain in the result ($text;65;90;9;13), the time goes up into minutes; 8 compiled and 11 interpreted. I guess it's all about the payload.
Thanks, Keith - CDI > On Jun 15, 2017, at 9:08 PM, Keisuke Miyako via 4D_Tech > <[email protected]> wrote: > > as a match regex exercise, you could do... > > $test:=Method1 ("abcdefghijklmnopqrstuvwxyz";\ > Character code("k");Character code("m");\ > Character code("d");Character code("y")) > //dklmy > >> // ---------------------------------------------------- >> // Method: StringOmit >> // - Uses REPLACE STRING* to clear characters >> // INPUT1: Text - to strip >> // INPUT2: Longint - lowest allowed character code >> // INPUT3: Longint - highest allowed character code >> // INPUT{4}: Longint - additional allowed character codes >> // >> // OUTPUT: Text - with remaining characters >> // ---------------------------------------------------- >> >> C_TEXT($1;$in;$0;$out) >> C_LONGINT($2;$3) >> C_LONGINT(${4}) >> >> C_LONGINT($i;$pos;$len) >> C_TEXT($min;$max;$motif) >> >> $min:="\\u"+Substring(String($2;"&x");3) >> $max:="\\u"+Substring(String($3;"&x");3) >> >> $motif:="["+$min+"-"+$max >> >> For ($i;4;Count parameters) >> $motif:=$motif+"\\u"+Substring(String(${$i};"&x");3) >> End for >> >> $motif:=$motif+"]+" >> >> $in:=$1 >> >> $i:=1 >> >> While (Match regex($motif;$in;$i;$pos;$len)) >> $out:=$out+Substring($in;$pos;$len) >> $i:=$pos+$len >> End while >> >> $0:=$out >> > > > > ********************************************************************** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: http://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:[email protected] > ********************************************************************** ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:[email protected] **********************************************************************

