Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String 在Delphi中使用转义序列取消转义字符串_String_Delphi_Escaping_Delphi 5 - Fatal编程技术网

String 在Delphi中使用转义序列取消转义字符串

String 在Delphi中使用转义序列取消转义字符串,string,delphi,escaping,delphi-5,String,Delphi,Escaping,Delphi 5,我使用Delphi 5,在http连接中有如下字符串: str :='content=bell=7'#$8'size=20'#$8'other1'#$D#$A#$8'other2' 这个字符串包含一些带有转义字符的序列,我想取消转义这些字符。如果我使用修剪功能,转义序列仍然在里面。也许这是因为“#$8”是不可见的标志 如何分别替换“#&8”。例如,使用“&”,以便获得字符串: str1 :='content=bell=7&size=20&other1'#$D#$A'&o

我使用Delphi 5,在http连接中有如下字符串:

str :='content=bell=7'#$8'size=20'#$8'other1'#$D#$A#$8'other2'
这个字符串包含一些带有转义字符的序列,我想取消转义这些字符。如果我使用修剪功能,转义序列仍然在里面。也许这是因为“#$8”是不可见的标志

如何分别替换“#&8”。例如,使用“&”,以便获得字符串:

str1 :='content=bell=7&size=20&other1'#$D#$A'&other2'
在此之后,我可以使用修剪来取消其他序列的景观

str2 :='content=bell=7&size=20&other1#13#10&other2'

这些是Delphi字符序列。编译器在处理源文件时解释它们。它将
#$8
转换为字符串中的退格字符。如果要用其他字符替换该字符,可以调用
StringReplace
。(如果这是您的真实代码,那么您可以跳过额外的函数调用,直接在代码中使用字符串文本中所需的字符。)


Trim
删除字符串开头和结尾的空白,但字符不在两端。

这些是Delphi字符序列。编译器在处理源文件时解释它们。它将
#$8
转换为字符串中的退格字符。如果要用其他字符替换该字符,可以调用
StringReplace
。(如果这是您的真实代码,那么您可以跳过额外的函数调用,直接在代码中使用字符串文本中所需的字符。)


Trim
删除字符串开头和结尾的空白,但字符不在两端。

如果D5有StringReplace:
str1:=StringReplace(str、#$8''、'&',[rfReplaceAll])
第二个参数不需要引号:
str1:=StringReplace(str,#$8,&',[rfReplaceAll])如果D5有StringReplace:
str1:=StringReplace(str、#$8''、'&',[rfReplaceAll])
第二个参数不需要引号:
str1:=StringReplace(str,#$8,&',[rfReplaceAll])Thx,这很有帮助。:)我想,我对Delphi.Thx中的字符转义有一些理解上的问题,这很有帮助。:)我想,我对Delphi中的角色转义有一些理解上的问题。
str2 := StringReplace(str1, #8, '&', [rfReplaceAll]);