我使用Delphi为LCDHype编写了一个插件,我想返回一个包含空格的字符串。这是一个例子:
…
履行
VAR gReturnValue:String;
// Plugin.Foo.GetBar…
插件的返回值由LCDHype解析,意味着返回值基本上是脚本代码。
这也意味着你必须返回一个 串 当你想保留空间。一个 串 以a开头和结尾 ' 性格喜欢
'
'This is a bar'
在Delphi中你需要逃避 ' 字符因此价值
'''This is a bar'''
您可以使用 QuotedStr() 逃避 ' 字符并正确引用字符串,例如:
QuotedStr()
uses SysUtils; // for QuotedStr() ... function Library_GetBar(const AParameter: PScriptFunctionImplementationParameter): PWideChar; stdcall; begin gReturnValue := QuotedStr('This is a bar'); result := PWideChar(gReturnValue); end;