Author Topic: test for Lazarus ( pascal language)  (Read 2005 times)

jurassic pork

  • Newbie
  • *
  • Posts: 1
    • View Profile
test for Lazarus ( pascal language)
« on: April 15, 2014, 11:46:30 PM »
hello,
test for pascal language  ( Lazarus)  with code=pascal :
Code: Pascal
  1. procedure TForm1.Button2Click(Sender: TObject);
  2. var
  3.   mystringlist, second_stringlist: TStringList;
  4.   nNAME, nNOMORID, nSTATUS, nPENDIDIKAN : string;
  5.  
  6. const
  7.   thestring : string ='ANDI 123456789.SIDOARJO.BELUM KAWIN.S1';
  8. begin
  9.   //close;
  10.   mystringlist:=TStringList.Create;
  11.   second_stringlist:=TStringList.Create;
  12.  
  13.   mystringlist.StrictDelimiter := True;
  14.   mystringlist.Delimiter:='.';
  15.   mystringlist.DelimitedText:=thestring;
  16.   nNAME := mystringlist[0];
  17.   nNOMORID := '';
  18.   nSTATUS := mystringlist[2];
  19.   nPENDIDIKAN := mystringlist[3];
  20.  
  21. // if first line of mystringlist contains spaces then split it to nname and nnomorid
  22.   if pos(' ', mystringlist[0])>0 then begin
  23.     second_stringlist.StrictDelimiter := True;
  24.     second_stringlist.Delimiter:=' ';
  25.     second_stringlist.DelimitedText:=mystringlist[0];
  26.     nNAME:=second_stringlist[0];
  27.     nNOMORID:=second_stringlist[1];
  28.   end;
  29.   memo1.clear;
  30.   memo1.Append(thestring);
  31.  
  32.   memo1.Append('name:' + nname);
  33.   memo1.append('nomorid:' + nNOMORID);
  34.   memo1.append('status:' + nstatus);
  35.   memo1.append('PENDIDIKAN:' + nPENDIDIKAN);
  36.  
  37.   mystringlist.free;
  38.   second_stringlist.Free;
  39. end;

with code=delphi :
Code: Delphi
  1. procedure TForm1.Button2Click(Sender: TObject);
  2. var
  3.   mystringlist, second_stringlist: TStringList;
  4.   nNAME, nNOMORID, nSTATUS, nPENDIDIKAN : string;
  5.  
  6. const
  7.   thestring : string ='ANDI 123456789.SIDOARJO.BELUM KAWIN.S1';
  8. begin
  9.   //close;
  10.   mystringlist:=TStringList.Create;
  11.   second_stringlist:=TStringList.Create;
  12.  
  13.   mystringlist.StrictDelimiter := True;
  14.   mystringlist.Delimiter:='.';
  15.   mystringlist.DelimitedText:=thestring;
  16.   nNAME := mystringlist[0];
  17.   nNOMORID := '';
  18.   nSTATUS := mystringlist[2];
  19.   nPENDIDIKAN := mystringlist[3];
  20.  
  21. // if first line of mystringlist contains spaces then split it to nname and nnomorid
  22.   if pos(' ', mystringlist[0])>0 then begin
  23.     second_stringlist.StrictDelimiter := True;
  24.     second_stringlist.Delimiter:=' ';
  25.     second_stringlist.DelimitedText:=mystringlist[0];
  26.     nNAME:=second_stringlist[0];
  27.     nNOMORID:=second_stringlist[1];
  28.   end;
  29.   memo1.clear;
  30.   memo1.Append(thestring);
  31.  
  32.   memo1.Append('name:' + nname);
  33.   memo1.append('nomorid:' + nNOMORID);
  34.   memo1.append('status:' + nstatus);
  35.   memo1.append('PENDIDIKAN:' + nPENDIDIKAN);
  36.  
  37.   mystringlist.free;
  38.   second_stringlist.Free;
  39. end;