zzh26(瞌睡) 说得对,用ByteType函数。我的错误就是用它解决的。
我还写了个简单的函数:
function GetVolidStr(const Value: String): String;
var
ResultStr : String;
begin
if Length(Value) > 0 then
begin
if ByteType(Value, Length(Value)) = mbLeadByte then
ResultStr := Copy(Value, 1, Length(Value)-1)
else
ResultStr := Value;
end
else ResultStr := '';
Result := ResultStr;
end;
你只需在调用GetVolidStr函数时,传你可能出错的字符串即可。