快捷搜索:  as  2018  FtCWSyGV  С˵  test  xxx  Ψһ  w3viyKQx

和记娱h188下载app:WinAPI 字符及字符串函数(12) lstrlen串长度



unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls;

type

TForm1 = class(TForm)

Button1: TButton;

Button2: TButton;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Send和记娱h188下载apper: TObject);

end;

var

Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

var

p: PChar;

buf: array[和记娱h188下载app0..255] of Char;

n1,n2: Integer;

begin

p := 'Delphi和记娱h188下载app9;;

buf := 'Delphi';

n1 := lstrlen(p);

n2 := lstrlen(buf);

ShowMessageFmt('%d,%d', [和记娱h188下载appn1,n2]); {6,6}

end;

procedure TForm1.Button2Click(Sen和记娱h188下载appder: TObject);

var

n1,n2: Integer;

begin

n1 := lstrlenA('万一的 Delphi 博客');

n2 := lstrlenW('万一的 Delphi 博客');

ShowMessageFmt('%d,%d', [n1,n2]); {18,13}

end;

end.

您可能还会对下面的文章感兴趣: