My Photo
Name:
Location: Bdg, Bgr, Jawa Barat, Indonesia

Posted At Monday, January 30, 2006

Substr
Seminggu yang lalu, si gua dipusingkan dengan ini....

ls_track := '1~02170806460~02270209529~2~20060112~20060113~UserGUI~Content IN~Content Out~Rusak^1~02170700070~02270209444~2~20060112~20060113~UserGUI~Content IN~Content Out2~Gak Jelas^1~02170674342~03166545643~2~20060112~20060113~UserGUI~Content IN~Content Out3~Ya, Gitu Deh^1~02170655445~02270443234~2~20060112~20060113~UserGUI~Content IN~Content Out4~Tau nih';
s_bufS:=upper(ls_track);
s_buffS:=s_bufS||'^';
ls_param := TRUE;
ls_pos := 1;
while (ls_pos>0) loop

ls_pos := instr(s_buffS,'^',1,1);

s_buffS2:=substr(s_buffS,1,ls_pos);
s_buffS :=substr(s_buffS,ls_pos+1);
s_buffS2:=rtrim(s_buffS2,'^');
s_buffS2:=s_buffS2||'~';
ls_stat :=substr(s_buffS2,1,instr(s_buffS2,'~',1,1)-1);
ls_mdna :=substr(s_buffS2,instr(s_buffS2,'~',1,1)+1,instr(s_buffS2,'~',1,2)-instr(s_buffS2,'~',1,1)-1);
ls_mdnb :=substr(s_buffS2,instr(s_buffS2,'~',1,2)+1,instr(s_buffS2,'~',1,3)-instr(s_buffS2,'~',1,2)-1);
ls_type :=substr(s_buffS2,instr(s_buffS2,'~',1,3)+1,instr(s_buffS2,'~',1,4)-instr(s_buffS2,'~',1,3)-1);
ls_rece :=substr(s_buffS2,instr(s_buffS2,'~',1,4)+1,instr(s_buffS2,'~',1,5)-instr(s_buffS2,'~',1,4)-1);
ls_send :=substr(s_buffS2,instr(s_buffS2,'~',1,5)+1,instr(s_buffS2,'~',1,6)-instr(s_buffS2,'~',1,5)-1);
ls_gui :=substr(s_buffS2,instr(s_buffS2,'~',1,6)+1,instr(s_buffS2,'~',1,7)-instr(s_buffS2,'~',1,6)-1);
ls_in :=substr(s_buffS2,instr(s_buffS2,'~',1,7)+1,instr(s_buffS2,'~',1,8)-instr(s_buffS2,'~',1,7)-1);
ls_out :=substr(s_buffS2,instr(s_buffS2,'~',1,8)+1,instr(s_buffS2,'~',1,9)-instr(s_buffS2,'~',1,8)-1);
ls_reas :=substr(s_buffS2,instr(s_buffS2,'~',1,9)+1,instr(s_buffS2,'~',1,10)-instr(s_buffS2,'~',1,9)-1);

ld_s := TO_DATE(ls_rece,'YYYY MM DD');
ld_e := TO_DATE(ls_send,'YYYY MM DD');
ls_s := to_char(ld_s,'Mon dd, yyyy');
ls_e := to_char(ld_e,'Mon dd, yyyy');
/*
ls_x1 :=substr(s_buffS,1,instr(s_buffS,'~',1,1)-1);
ls_x2 :=substr(s_buffS,instr(s_buffS,'~',1,1)+1,instr(s_buffS,'~',1,2)-instr(s_buffS,'~',1,1)-1);
ls_x3 :=substr(s_buffS,instr(s_buffS,'~',1,2)+1,instr(s_buffS,'~',1,3)-instr(s_buffS,'~',1,2)-1);
ls_x4 :=substr(s_buffS,instr(s_buffS,'~',1,3)+1,instr(s_buffS,'~',1,4)-instr(s_buffS,'~',1,3)-1);
ls_x5 :=substr(s_buffS,instr(s_buffS,'~',1,4)+1,instr(s_buffS,'~',1,5)-instr(s_buffS,'~',1,4)-1);
ls_x6 :=substr(s_buffS,instr(s_buffS,'~',1,5)+1,instr(s_buffS,'~',1,6)-instr(s_buffS,'~',1,5)-1);
ls_x7 :=substr(s_buffS,instr(s_buffS,'~',1,6)+1,instr(s_buffS,'~',1,7)-instr(s_buffS,'~',1,6)-1);
ls_x8 :=substr(s_buffS,instr(s_buffS,'~',1,7)+1,instr(s_buffS,'~',1,8)-instr(s_buffS,'~',1,7)-1);
ls_x9 :=substr(s_buffS,instr(s_buffS,'~',1,8)+1,instr(s_buffS,'~',1,9)-instr(s_buffS,'~',1,8)-1);
ls_x10 :=substr(s_buffS,instr(s_buffS,'~',1,9)+1,instr(s_buffS,'~',1,10)-instr(s_buffS,'~',1,9)-1);

ls_client:=trim(substr(ls_x1,instr(ls_x1,'=')+1));
ls_mdnx:=trim(substr(ls_x2,instr(ls_x2,'=')+1));
ls_ddate1:=trim(substr(ls_x3,instr(ls_x3,'=')+1));
ls_ddate2:=trim(substr(ls_x4,instr(ls_x4,'=')+1));
ls_sts:=trim(substr(ls_x5,instr(ls_x5,'=')+1));
ls_user:=trim(substr(ls_x6,instr(ls_x6,'=')+1)); */

htp.prn('

'||ls_mdna||'
'||ls_mdnb||'
'||ls_type||'
'||ls_s||'
'||ls_e||'
'||ls_gui||'
'||ls_in||'
'||ls_out||'
'||ls_stat||'
'||ls_reas||'
');

NB : ls_track dan ls ls yang lain -> variabel untuk menangkap hasil suatu proses...
substr -> fungsi untuk mengambil kata tertentu dari posisi tertentu...
instr -> fungis untuk mengetahui posisi suatu karakter...
Posted by Donny @ 10:00 AM

Ada 4 orang yang cuap-cuap :

At 30 January, 2006 12:39, Anonymous lucky said...

hari ini...si saya dipusingkan dengan tulisan tentang substr...
hehehe, blog-nya saya link yak!

 

At 30 January, 2006 12:46, Blogger Donny said...

OK..nanti saya link juga...repot ngotak-ngatik template sambil kerja nih...

 

At 02 February, 2006 13:03, Anonymous anina said...

nye cript kok di blog sih om??? :D

 

At 03 February, 2006 17:28, Blogger Donny said...

biasa mbak..kan abis stress...

 

Post a Comment

Links to this post:

Create a Link

<< Home

Copyright © 2006 Bom Bye
Design : Donny Reza