Ghoast 0 Posted September 9, 2012 Report Share Posted September 9, 2012 I'm trying to make a bot which can take a 500 word article and put html code into it at various places.. I basically want it to insert the HTML code after either the first, second, third, fourth or fith full stop in every article. This should be chosen at random.. SO far I'm using the 'insert text' function and I'm not sure what to put in the 'position to insert text' box.. Would appreciate any help on this one Quote Link to post Share on other sites
Ghoast 0 Posted October 7, 2012 Author Report Share Posted October 7, 2012 I've made a bot which should insert a string of text into a block of text. I want it to insert the text after a random fullstop '.' So far I've got this: set(#blocktext - text from file set(#blocktext, $insert text(#blocktext, ". {#stringtoinsert}", $find index(#blocktext, ".")), "Global") This inserts my string after the FIRST fullstop in every block text.. However I want to randomize this and make it choose a random full stop to insert the string after. After some hours of working on it I think a solution could be to return the indexes of all the full stops and then instruct ubot to choose a random position from these numbers to insert the string after.. Any ideas? Quote Link to post Share on other sites
VaultBoss 310 Posted October 8, 2012 Report Share Posted October 8, 2012 You could build a list from your text, using the ". " sequence as a separator (assuming all your periods are followed by a space as it should normally be, except the last one, probably) Then, you can rebuild the text inserting anything you want in between the list items (randomizing that, as you wish, of course) HTH Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.