RosettaCodeData/Task/Odd-word-problem/AutoHotkey/odd-word-problem.ahk

8 lines
234 B
AutoHotkey
Raw Permalink Normal View History

2015-11-18 06:14:39 +00:00
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