How can I check if a variable has spaces? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
fenchai
Posts: 292
Joined: 28 Mar 2016, 07:57

How can I check if a variable has spaces?

20 Jan 2017, 14:01

if say var = I have to google something
It contains spaces where
var = NoSpaces
contains NO spaces.

I need this to make my searcher recognize I am making a Google Search instead of another type of search.
User avatar
JoeWinograd
Posts: 2203
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: How can I check if a variable has spaces?  Topic is solved

20 Jan 2017, 14:10

The doc explains it well:
IfInString

For example:

Code: Select all

IfInString,var,%A_Space%
{
  code here for var containing at least one space
}
Else
{
  code here for var containing no spaces
}
Regards, Joe
fenchai
Posts: 292
Joined: 28 Mar 2016, 07:57

Re: How can I check if a variable has spaces?

20 Jan 2017, 14:19

[quote="JoeWinograd"]The doc explains it well:
IfInString


Thanks Joe!
User avatar
JoeWinograd
Posts: 2203
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: How can I check if a variable has spaces?

20 Jan 2017, 14:26

You're welcome — good luck with the script!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: haomingchen1998 and 156 guests