#68608 - 2002-07-26 01:32 AM
Re: Results of the Kixtart Golf Tournament III
|
kholm
Korg Regular
   
Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
|
I claime no position in the hall of fame but: I was wondering if any of you had noticed this:
I CAN shave 6 point of by this completely idiotic use of the split function: I use: $=Split($a,'"')[1] Instead of : $=SUBSTR($a,2,LEN($a)-2)
This is only useful if the string is surounded by a specific char, and you want to remove that, in this case ".
It is 6 chars shorter but as for speed ???
I published this in my script, but nobody seames to have noticed, not even Lonkero
-Erik
|
|
Top
|
|
|
|
#68609 - 2002-07-26 01:56 AM
Re: Results of the Kixtart Golf Tournament III
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Erik, I too used that construct in my final script, but not the same way. C:\Data\Scripts\Golf>C:\Data\Kix2001\KiX2001.410\kix32 golf5b.kix
check for all registry keys Errors:0 check for registry value types in import1:0 check for registry value types in import2:0 check for registry value types in import3:0 check for registry values in import1:0 check for registry values in import2:0 check for registry values in import3:0 The UDF ImportRegFile passed the validation test. Please do not forget to post your KiXtart Golf score.
KixGolf score = 822
code:
function ImportRegfile($) Dim $A[4], $C, $D, $G, $i, $K, $N, $o $o = createobject("VBscript.RegExp") $o.Global = 1
if ubound($)<0 $=$,"" endif for each $ in $ $=open(1,$) do $C=$C+ReadLine(1)+"`" until @error $=close(1) next
$=join(split($C,"\` "),"")
$o.Pattern = '`\[(\-?)(.*?)\](?=`)|`"?([\w\- ]+)?@@?"?=("|.{3,6}\:)?(.*?)"?(?=`)' for each $ in $o.Execute($) for $i=0 to 4 $A[$i]=$.SubMatches($i) next
if $A[1] $K=$A[1] if $A[0] $=DelKey($K) else $=AddKey($K) endif else ;Add Values $N=$A[2] $D=$A[4] for $i=0 to 5 if $A[3]=split('dword: hex: " hex(2): hex(7):')[$i] $=$i endif next if $=0 $D=val("&"+$D) endif for each $C in split($D,",") if $=3 | $C>"00" & $=5 $i=execute('$C=Chr(&'+$C+')') endif $G=""+$G+$C next $D=$G $G="" if $=5 $D=join(split($D,'0000'),"|") endif
;Write Value if $D="-" $=DelValue($K, $N) else $=WriteValue($K, $N, $D, "REG_"+split('DWORD BINARY SZ EXPAND_SZ MULTI_SZ')[$]) endif endif next $ImportRegfile=0 exit 0 endfunction
[ 26 July 2002, 01:57: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 699 anonymous users online.
|
|
|