Sha*_*elt -1 delphi string reverse
我正在尝试在 Delphi 中反转字符串。如何使用 AnsiReverseString 函数反转字符串?
需要添加和使用什么单位?该功能是如何工作的?
小智 5
就像每个人在评论中所说的那样,将StrUtils单位添加到您的uses条款中。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StrUtils, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
source, target : AnsiString;
begin
source := '123456789';
target := AnsiReverseString(source);
ShowMessage('Source = '+source);
ShowMessage('Target = '+target);
end;
end.
Run Code Online (Sandbox Code Playgroud)