We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Random text (Read 613 times)
Random text
May 28th, 2008, 10:35pm
 
[/feel like such a n00b for asking this, but couldn't find the n00b forum]

I want to create a sketch that will 'read' a text document (for instance Paradise Lost, King James Bible etc) and then export either a .txt or pdf of a predefined number of 2 or 3 word strings randomly form the text imported.

For example the above could render:

I sketch
King Lost
predefined form

I would want the process to be completely automated in the same way that the library>pdf>randombook example is. (which would presumably simplify the code..?)
Could anyone point me in the right direction as I am lost beyond loading the text.

Thanks
Re: Random text
Reply #1 - May 28th, 2008, 10:46pm
 
sure :

Reference > Input > Files > loadStrings()
http://processing.org/reference/loadStrings_.html

then,

Reference > String functions > split()
http://processing.org/reference/split_.html
Re: Random text
Reply #2 - May 28th, 2008, 10:49pm
 
Simple as that!

I really should read the documentation before wasting bandwidth..!

Thanks for your fast reply Wink
Page Index Toggle Pages: 1