How to add apostrophe (") to string?

前端 未结 3 741
终归单人心
终归单人心 2021-01-23 14:19

I have this AutoIt script:

ControlFocus(\"Open\", \"\", \"Edit1\")
Sleep(500)
ControlSetText(\"Open\", \"\", \"Edit1\", $CmdLine[1])
Sleep(500)
ControlClick(\"Op         


        
3条回答
  •  走了就别回头了
    2021-01-23 14:49

    AutoIt supports two types of quoting, which are interchangeable:

    MsgBox(0, "single-double", 'hello " world')   ; hello " world
    MsgBox(0, "double-single", "hello ' world")   ; hello ' world
    MsgBox(0, "double-double", "hello "" world")  ; hello " world
    MsgBox(0, "single-single", 'hello '' world')  ; hello ' world
    

    I personally prefer the first two (depending on how my string looks like).

    So one of those should do:

    ControlSetText("Open", "", "Edit1", $CmdLine[1] & '"') ; Changing quoting where needed
    ControlSetText('Open', '', 'Edit1', $CmdLine[1] & '"') ; Changing quoting consistent
    

提交回复
热议问题