AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sending a space as part of the delimiter for StringSplit

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
merc1286
Guest





PostPosted: Thu Mar 13, 2008 3:03 pm    Post subject: Sending a space as part of the delimiter for StringSplit Reply with quote

Hi, I am trying to use StringSplit to split a string wherever " - " is found (a space, then a dash, then another space). I have tried a number of things, but they either don't work or automatically trim off the spaces and just split on any - whether or not it is surrounded by spaces. I have tried the following:

StringSplit, x_array, x, -
StringSplit, x_array, x, " - "
StringSplit, x_array, x, {Space}-{Space}

But none of them worked. The 3rd one actually seemed to split it at the first occurrence of the letter S.

Any ideas? thanks.
Back to top
BoBoĻ
Guest





PostPosted: Thu Mar 13, 2008 3:12 pm    Post subject: Reply with quote

Code:
StringSplit, x_array, x, % " - " ; expression-type coding
StringSplit, x_array, x, {A_Space}-{A_Space} ; traditional-type coding
Back to top
merc1286
Guest





PostPosted: Thu Mar 13, 2008 3:39 pm    Post subject: Reply with quote

Hi, thanks for trying, but neither of those worked. The first one delimited it at the first occurrence of a -, even one without any spaces around it, and the other delimited it at the first occurrence of the letter A. Any other thoughts?

Thanks!
Back to top
merc1286
Guest





PostPosted: Thu Mar 13, 2008 4:53 pm    Post subject: Reply with quote

Actually, further investigation has shown me that what it's doing is, even when I have " - " specified as the delimiter, it appears to be treating that as 3 separate delimiters (a space, a dash, and another space), and then searching for the first occurrence of any of those. How can I tell it to search for the entire string?
Back to top
Kellianjaxon



Joined: 04 Jan 2008
Posts: 39

PostPosted: Fri Mar 14, 2008 2:22 am    Post subject: Reply with quote

merc1286 wrote:
How can I tell it to search for the entire string?


From AHK help: "To use a string as a delimiter rather than a character, first use StringReplace to replace all occurrences of the string with a single character that is never used literally in the text."
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group