I am trying to make a UDF that takes a text in spintax format {word1|word2|word3} and returns one instance of that text. For some reason it deletes the previous replaced segments. The whole sentence should be replaced. I don't know how to proceed.
One correct version: Howdy People! AutoIt is an amazing programming language.
;Spintax Test
$nOffset = 1
; Text in Spintax format
$spintext = '{Hello|Hi|Howdy} {World|People|Dude}! {AutoIt|C++|C|Java} is an {awesome|amazing} {language|pro
I just had a couple of eureka moments. This is the kind of mindpuzzle where i forget to eat and drink until i solved it.
;Spintax Test
#include <Array.au3>
; Text in Spintax format
;~ Global $a = 1
$spintext = '{{Hello|Hi|Howdy} {World|People|Dude}!}|{{Good Day|Excuse Me|Greetings} {Everyone|Ladys and Gents|Mister},} {AutoIt|C++|C|Java} is a{n {awesome|amazing}}|{{ wonderful|n astonishing}} {language|programming language}.'
ConsoleWrite(Spintax($spintext) & @CRLF)
ConsoleWrite(Spi