if Memo1.Text = '' then

解决方案 »

  1.   

    if memo1.Lines.Count=0 then showmessage('空');
    pchar->string strpas(p:pchar)
    string->pchar pchar(s:string)
      

  2.   

    Trim() //去左右不可见字符
      if Trim(Memo1.Text) = '' then //空格空行都不算
    Pos() //子串位置
      if Pos('1', Memo1.Text) > 0 then //有"1"
    Copy() //取子串
      Copy(Memo1.Text, 1, 1) //第一个字符
    Length() //取长度
      Length(Memo1.Text) //文本长度
    StringReplace() //替换子串
      StringReplace(Memo1.Text, #13#10, ';', [rfReplaceAll]) //把换行替换成";"
      

  3.   

    var
      P: PChar; //和array[0..Size] of Char;//相近
      S: string;
    begin
    //....
      P := PChar(S); //强制转换
    //....
      S := P; //直接赋值
    {单独使用PChar时用GetMem()分配资源,用FreeMem()释放资源}
    end;(*
    StrToInt()
    StrToFloat()
    StrToDate()
    StrToBool()
    *)