Cannot split word into individual letters in a memo

后端 未结 1 1290
遥遥无期
遥遥无期 2021-01-29 06:39
unit frmDisplaySentence_u;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls;

type
  TfrmDispO         


        
1条回答
  •  走了就别回头了
    2021-01-29 07:25

    Delphi is not like ie Python where whitespace is significant and defines block. In Delphi you have to use begin and end to mark the block, in this case your for loop:

    procedure TfrmDispOneChar.btnDisplayClick(Sender: TObject);
    var
        K, iLength : integer;
        cOne : char;
        sCode : string;
    begin
        sCode := edtCode.Text;
        iLength := Length(sCode);
        for K := 1 to iLength do begin
            cOne := sCode[K];
            memOutput.Lines.Add(cOne);
        end;
    end;
    

    0 讨论(0)
提交回复
热议问题