Vous êtes sur la page 1sur 2

SCRIPTING

PRECEDING LOAD IS ELEGANT


AUG 26, 2014 LEAVE A COMMENT
I love the precedin lo!d "e!t#re o" $li%vie& 'criptin( It c!n )!%e co)ple* thin' 'i)ple(
Con'ider "or e*!)ple, h!vin to p!r'e !n !r+itr!r, n#)+er o" key:value p!ir' "ro) inp#t li%e-
Name:Shoes, Size:L, Color:Blue Suede, Stock: 200
Name:Socks, Model:Mens Casual, Stock:0, Color:Black
Name:Pants, Error: No attriutes !ound
.e &!nt e!ch key to +eco)e ! /ield pop#l!ted &ith it0' )!tchin value( 1ere0' the entire 'cript
to do 2#'t th!t( A precedin lo!d i' ! 'erie' o" ch!ined LOA3' th!t e*ec#te "ro) the +otto) #p 4
'o re!d the 'cript "ro) the +otto)(
And no& &e c!n +#ild ! ch!rt li%e thi'(
5i)ple( Ele!nt(
I0ll +e 'ho&in 'o)e other cool e*!)ple' o" 6recedin Lo!d in ), 7Adv!nced 5criptin8 'e''ion !t
the M!'ter' 5#))it "or $li%vie& Oct 1(
9:o+
Script suitable for copy/paste
data:
"" #$ %eneric Load to trans&ose 'ey to (ield
%eneric L)*+ ,ec-d, 'ey, .alue
/
"" 0$ Se&arate key 1 value
L)*+
,ec-d,
su!ield2Pair,3:3,45 as 'ey,
su!ield2Pair,3:3,25 as .alue
/
"" 2$ Break out each key:value &air
L)*+
,ec-d,
su!ield2-n&ut,3,35 as Pair
/
"" 4$ Load the ra6 -n&ut
L)*+ 7, ,ecNo25 as ,ec-d -NL-NE 8
-n&ut
Name:Shoes, Size:L, Color:Blue Suede, Stock: 200
Name:Socks, Model:Mens Casual, Stock:0, Color:Black
Name:Pants, Error: No attriutes !ound
9 2delimiter is 3:35
/

Vous aimerez peut-être aussi