RosettaCodeData/Task/Odd-word-problem/AutoHotkey/odd-word-problem.ahk
2015-11-18 06:14:39 +00:00

7 lines
234 B
AutoHotkey

str := "what,is,the;meaning,of:life."
loop, parse, str
if (A_LoopField ~= "[[:punct:]]")
res .= A_LoopField, toggle:=!toggle
else
res := toggle ? RegExReplace(res, ".*[[:punct:]]\K", A_LoopField ) : res A_LoopField
MsgBox % res