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 

easy syntax question - StringReplace

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





PostPosted: Fri Apr 29, 2005 6:34 pm    Post subject: easy syntax question - StringReplace Reply with quote

Does anyone know the proper way to replace a comma with a pipe ( | )using StringReplace? I've tried:

StringReplace, Var1, Var1, , , |,All
StringReplace, Var1, Var1, ', , |,All
StringReplace, Var1, Var1, ,%,% |,All

but nothing seems to work. Does anyone know the proper syntax?
Back to top
JGpo
Guest





PostPosted: Fri Apr 29, 2005 6:56 pm    Post subject: easy syntax question - StringReplace Reply with quote

I figured it out, thanks all!

var1 = ,
msgbox %var1%
var2 = 234,21,2,3,24,1,32,4,1,2,3,4,2,12,32,4,2,2
stringreplace, var2, var2, %var1%, |,A
msgbox, %var2%
Back to top
BoBo
Guest





PostPosted: Fri Apr 29, 2005 7:05 pm    Post subject: Reply with quote

the proper way to use a "literal comma" within an AHK command would be to escape it this way ...
Quote:

InputVar = 234,21,2,3,24,1,32,4,1,2,3,4,2,12,32,4,2,2
StringReplace, OutputVar, InputVar, `,, |, All
MsgBox, %OutputVar%

Check the help for #EscapeChar Wink
Back to top
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