String problem

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Alcrkai
Posts: 47
Joined: 16 Mar 2021, 10:51

String problem

Post by Alcrkai » 14 Jul 2021, 05:16

Good Morning.

I need some help, as I do to just use ". I need to put variables in a String with quotes. Here's an example:

"http>//Test.com/test/teste1?firstvariable=variablehere&secondvariable=variablehere"

Where there is variablehere, I wanted to replace it with the variables, but it is necessary to contain the quotes

AHKStudent
Posts: 1472
Joined: 05 May 2018, 12:23

Re: String problem

Post by AHKStudent » 14 Jul 2021, 06:07

Code: Select all

firstvariable := "hello"
secondvariable := "world"
variablehere := "helloworld"

var := """http>//Test.com/test/teste1?" . firstvariable . "=" . variablehere . "&" . secondvariable . "=" . variablehere """"
MsgBox, % var
ExitApp

User avatar
boiler
Posts: 17387
Joined: 21 Dec 2014, 02:44

Re: String problem

Post by boiler » 14 Jul 2021, 06:08

Expression syntax:

Code: Select all

URL := """http>//Test.com/test/teste1?" firstvariable "=" variablehere "&" secondvariable "=" variablehere """"

Legacy syntax:

Code: Select all

URL = "http>//Test.com/test/teste1?%firstvariable%=%variablehere%&%secondvariable%=%variablehere%"
Last edited by boiler on 14 Jul 2021, 06:09, edited 1 time in total.

Alcrkai
Posts: 47
Joined: 16 Mar 2021, 10:51

Re: String problem

Post by Alcrkai » 14 Jul 2021, 06:09

I managed to solve my problem with the string replace. Thank you though.

Post Reply

Return to “Ask for Help (v1)”