Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.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
Applescript 删除特殊字符_Applescript - Fatal编程技术网

Applescript 删除特殊字符

Applescript 删除特殊字符,applescript,Applescript,我需要使用applescript将其转换为字符串: \", \"resource_id\ 我发现的问题是“\”用于告诉applescript引号是字符串的一部分 关于如何将整组字符转换为applescript字符串,您有什么想法吗 Loren反斜杠用作AppleScript字符串中特殊字符(引号)的转义字符,因此要在字符串中使用转义字符,还必须对其进行转义。因此,您的转义字符串将是: set theString to "\\\", \\\"resource_id\\" 您可以使用ASCII码

我需要使用applescript将其转换为字符串:

\", \"resource_id\
我发现的问题是“\”用于告诉applescript引号是字符串的一部分

关于如何将整组字符转换为applescript字符串,您有什么想法吗


Loren

反斜杠用作AppleScript字符串中特殊字符(引号)的转义字符,因此要在字符串中使用转义字符,还必须对其进行转义。因此,您的转义字符串将是:

set theString to "\\\", \\\"resource_id\\"

您可以使用ASCII码代替反斜杠字符和引号字符:

    tell application "Finder"
        activate
        set bSlash to (ASCII character 92) ---> sets the variable bSlash to \
        set qMark to (ASCII character 34) ---> sets the variable qMark to "
        set theString to bSlash & qMark & ", " & bSlash & qMark & "resource_id" & bSlash ---> sets the variable theString to \", \"resource_id\
        display dialog theString
    end tell
除非我误解了你的需要——但无论如何,你知道我要做什么