popovIliya

Sample string loop

Feb 20th, 2021
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.74 KB | None | 0 0
  1. procedure sampleStrLoop();
  2. Var
  3. i,icount,strBr: integer;
  4. Const
  5. listStr: string = 'onil-chan'  ;
  6. begin
  7. icount:= 0;  strBr:= 0;
  8.       for i := 1 to Length(listStr) do
  9.       begin
  10.       if UpCase(listStr[i]) in ['A','E','I','O','U'] then
  11.         begin  
  12.          self.ListResult.Items.Add(listStr[I]);// TListBox
  13.          icount := icount + 1;
  14.          end
  15.          else
  16.          begin
  17.            strBr := strBr + 1;
  18.          end;
  19.       end;
  20.        ShowMessage('Брой итерации на цикъла фор: ' + (i-1).Tostring() + ',   ' + 'Брой на намерeните знаци: ' + icount.Tostring() +
  21.         ',   ' + 'Брой итерации на несравнимите стойности: ' + strBr.ToString() );
  22. end;
Advertisement
Add Comment
Please, Sign In to add comment