如题.最好是用代码来实现转换,谢谢.
解决方案 »
- Listview改变列宽后竖线没有消失
- Delphi如何实现鼠标移动加速
- 关于界面的问题的求答
- SPCOMM中给它的属性赋置时,类型怎么转换???
- 关于多线程调用Dll文件需要注意的地方?
- 问个简单的问题,谢了
- 一直不会使用类的CREATE方法,想学习一下做一个类的实例,然后再取消,请举个例子
- 请问TFileStream,TMemoryStream,TblobStream有什么区别
- 请问在win2000下如何读出IE收藏夹的存放目录(在98下是固定的windows安装目录下的Favorites目录),请给出具体代码,多谢!
- 在DELPHI中如何给子目录更名!
- 要招聘程序员了,谁有好的程序笔试试券
- 函数问题
function UnicodeStrToStr(S:string):WideString;
var
tls:TStringList;
i:Integer;
M:WideString;
One:Integer;
J:Integer;
S1,S2:string;
K:Char;
Black:Boolean;
Has:Boolean;
begin
One:=Pos('#',S);
if (One=0)or(Pos('font',LowerCase(S))>0)or(Pos('mask',LowerCase(S))>0)or(Pos('displayformat',LowerCase(S))>0) then
Result:=S
else begin
if S[Length(S)] in [')',']','+'] then
begin
K:=S[Length(S)];
end
else K:=#0;
M:=Copy(S,1,One-1);
if K<>#0 then
S:=Copy(S,One+1,Length(S)-One-1)
else
S:=Copy(S,One+1,Length(S)-One);
if Trim(M)<>'' then
begin
if M[Length(M)]='''' then
begin
M:=Copy(M,1,Length(M)-1);
Has:=True;
end
else Has:=False;
Black:=False;
end
else begin
Black:=True;
Has:=False;
end; tls:=TStringList.Create;
try
PartitionString(S,'#',tls,True);
if (not Has)and((Copy(S,1,2)<>'10')or((Copy(S,1,2)='10')and(IsInteger(Copy(S,1,3))))) then
M:=M+'''';
for I:=0 to tls.Count-1 do
begin
if tls[I]<>'' then
begin
J:=Pos('''',tls[I]);
if J=0 then
begin
if tls[I]='13' then
begin
M:=M+'''#13';
end
else if tls[I]='10' then
begin
M:=M+'#10''';
end
else begin
if (I=0)and (tls.Strings[I]='39')and Has then
M:=M+'''';
M:=M+WideChar(StrToInt(tls.strings[I]));
if (((I=0)and Black) or(I>0))and(tls.Strings[I]='39') then
M:=M+'''';
end;
end
else begin
S1:=Copy(tls[I],1,J-1);
S2:=Copy(tls[I],J+1,Length(tls[I])-J-1);
if S1='13' then
begin
M:=M+'''#13';
end
else if S1='10' then
begin
M:=M+'#10'''+S2;
end
else begin
if (I=0)and (S1='39')and Has then
M:=M+'''';
M:=M+WideChar(StrToInt(S1));
if (((I=0)and Black) or(I>0))and(S1='39') then
M:=M+'''';
M:=M+S2;
end;
end;
end;
end;
if tls[tls.Count-1]<>'13' then
M:=M+'''';
if K<>#0 then
Result:=M+K
else Result:=M;
finally
tls.Free;
end;
end;
end;
{将字符串分割成一个StringList}
procedure PartitionString(StrV,PrtSymbol:string;strList:TStrings;KillBlack:Boolean=True);
var
iTemp: integer;
begin
strList.Clear;
iTemp := pos(PrtSymbol,StrV);
while iTemp>0 do begin
if iTemp>1 then
begin
if KillBlack then
StrList.Append(Trim(copy(StrV,1,iTemp-1)))
else
StrList.Append(Copy(StrV,1,iTemp-1));
end;
delete(StrV,1,iTemp+length(PrtSymbol)-1);
iTemp := pos(PrtSymbol,StrV);
end;
if KillBlack then
if Trim(Strv)<>'' then
StrList.Append(Trim(StrV))
else if StrV<>'' then
StrList.Append(StrV);
end;
不过文字为什么变成了数字,能不能指点下!在次感谢!
有关Unicode字符的说明介绍,你在Google里面搜索一下,很多的.