在Power Builder中尝试用〜符号替换转义字符 [英] In Power Builder trying to replace a escape character with ~ sign
问题描述
我是力量构建者的新手,我正在尝试使用替换功能。我需要用〜'替换字符串中的aposthope('),但这给我一个错误函数的错误参数列表:replace。
I am new to the power builder I am trying to use replace function. I needed to replace a aposthope(') in string with ~' but it is giving me an error "Bad argument list for function: replace" .
Signature = "Gagandeep S'ingh"
Signature = Replace (Signature , "'", "~'")
这里有任何帮助。
推荐答案
波浪号是修饰符在PowerBuilder中。它具有的第一个功能是代表特殊字符,因此对于回车符,换行符和制表符,您分别具有〜r,〜n,〜t
。
第二个函数是转义符,它删除了以下字符的任何特殊含义。这样,您就可以编写〜
之类的东西来制作包含引号字符的字符串。在这种情况下,最好编写''
,但是如果您已经这样做并且想要单引号,则必须对其进行转义。为DataWindow创建表达式需要额外的转义级别,在此我将不再赘述。编写〜’
时发生的情况是,代字号告诉PowerBuilder将单引号视为普通字符。在这种情况下,它还是会这样做,因为它不在单引号字符串内。这就是为什么要用另一个替换。的原因。如果您想要〜’,则必须编写 ~~’
。第一个波浪号告诉PowerBuilder将后面的波浪号视为常规字符,最后得到〜’。 PowerBuilder帮助将 ~~
列为波浪号的特殊字符,而〜'
和〜
用作引号字符,但是当您使用一个以上级别的转义时,最好将其视为转义符并从左到右工作。
Tilde is a modifier character in PowerBuilder. The first function it has is to represent special characters, so you have ~r, ~n, ~t
for carriage return, newline, and tab.
The second function is an escape that removes any special meaning of the following character. This allows you to write things like "~""
to make a string that contains a quote character. In that case it's better to write '"'
, but if you've already done that and want a single quote you have to escape it. Creating expressions for the DataWindow requires additional levels of escaping that I won't get into here. What's happening when you write "~'"
is that the tilde tells PowerBuilder to treat the single quote as an ordinary character. It would do that anyway in this case since it's not inside a single-quoted string. That's why you're replacing the ' with another '. If you want ~' you have to write "~~'"
. The first tilde tells PowerBuilder to treat the following tilde as a regular character, and you end up with ~'. PowerBuilder help lists ~~
as the special character for tilde, and ~'
and ~"
for the quote characters but when you work with more than one level of escaping you're better off treating it as an escape and working left to right.
这篇关于在Power Builder中尝试用〜符号替换转义字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!