autoit - randomize text replacement with stringreplace function -


so in need of replacing string text autoit using stringreplace need randomize output.

an example of need is

stringreplace($string, "and", {also|as well}) 

my ultimate goal randomly replace text following options based on word "and" or well

i wrote long time ago.

it convert this

my name {john|peter|mark}! {regards|cheers|get lost}! 

to this

my name john! cheers! 

it works line breaks also.

func spintaxtotxt($textwithspintax)       dim $msgmsg     dim $lines      $lines = stringsplit($textwithspintax, @lf)       $z = 1 $lines[0]          if $z > 1 $msgmsg &= @lf           $d = stringsplit($lines[$z], "{}")          $i = 1 $d[0]              $msgsplit = stringsplit($d[$i], "|")             if @error                 $msgmsg &= $msgsplit[1]                 continueloop             endif             $msgmsg &= $msgsplit[random(1, $msgsplit[0], 1)]          next        next       return $msgmsg  endfunc   ;==>spintaxtotxt 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -