当前位置:首页>开发>正文

XML文件特殊字符处理 怎样在Delphi中处理字符串

2023-05-30 10:47:03 互联网 未知 开发

 XML文件特殊字符处理 怎样在Delphi中处理字符串

XML文件特殊字符处理

保存的时候,做一下编码。
这些是一个一个地得到Field的吧,在得到这些字Field的,进行编码,
查找特殊字符,取ASCII(中文就是UNICODE码) int型,转成String、前面添加

怎样在Delphi中处理字符串?

//取左边数n个字符function LeftStr (const S : string const N : Integer): stringbeginendbegin//取字符串中Ch字符左边的内容function LeftTillStr (const S : string const Ch : Char): string M: Integer M := Pos (Ch, S) if M < 2 then Result := else Result := Copy (S, 1, M - 1)end//取右边数n个字符 Result := Copy (S, 1, N)function RightStr (const S : string const N : Integer): stringvar M: Integerbegin M := Length (S) - N 1 if M < 1 then M := 1 Result := Copy (S, M, N)endvar//取字符串中Ch字符右边的内容function RightAfterChStr (const S : String const Ch : Char): Stringvar M: Integerbegin M := Pos (Ch, S) if M = 0 then Result := else Result := Copy (S, M 1, Length (S) - M)end

最新文章