I've got a string, containing name/value pairs,
eml:='clientName|img_0196.jpg||mime|||size|3195562||serverFileName|upload/548a5b35003bf.img_0196.jpg',
that I need to split on '|'.
I want to get {'clientName','img_0196.jpg',,'mime',,,'size',...}. My code is:
RAISE NOTICE 'eml: %', eml;
fields := regexp_split_to_array( eml, E'\|' );
fieldsLen := array_length(fields,1);
RAISE NOTICE 'fields, array_length(fields): %,%', fields, fieldsLen;
I get:
NOTICE: eml: clientName|img_0196.jpg||mime|||size|3195562||serverFileName|upload/548a5b35003bf.img_0196.jpg
NOTICE: fields, length(fields): {c,l,i,e,n,t,N,a,m,e,|,i,m,g,_,0,1,9,6,.,j,p,g,|,|,m,i,m,e,|,|,|,s,i,z,e,|,3,1,9,5,5,6,2,|,|,s,e,r,v,e,r,F,i,l,e,N,a,m,e,|,u,p,l,o,a,d,/,5,4,8,a,5,b,3,5,0,0,3,b,f,.,i,m,g,_,0,1,9,6,.,j,p,g},94
Can someone help? Thanks.