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.
IndexProgramming Questions & HelpIntegration › String manipulation (stringBuffer and regex)
Page Index Toggle Pages: 1
String manipulation? (stringBuffer and regex) (Read 2030 times)
String manipulation? (stringBuffer and regex)
Apr 19th, 2006, 10:57am
 
Hi there,

This is my first post, I've been playing with Processing for a few days because I have had to teach it this week(!)

Processing sufficiently similar to Flash and Director (my usual tools) that I have got up to speed quickly enough, but I'd like to do some stuff with text, and the documentation seems a little thin on how to work with strings, referring only to Sun's (monolithic) Java documentation, and there I got lost. I haven't done much Java programming, and only know a bit of the API.

Are ALL the properties and methods of the java.lang.string class available in Processing?

I notice there is charAt, indexOf and substring, but I am particularly interested in tokenizing, concatenation and so on. In Java this would require the tokenizer class and the stringBuffer class, but it's not clear how that would work with processing.

Is there some general documentation somewhere about using the standard Java classes (in particular I am interested in java.util.regex) in Processing?

Thanks in advance for any help.
Re: String manipulation? (stringBuffer and regex)
Reply #1 - Apr 19th, 2006, 11:17am
 
Tokenising has been tidied up in Processing and you can use the split function and its friends.

http://processing.org/reference/split_.html
http://processing.org/reference/trim_.html
http://processing.org/reference/join_.html

These are linked from the complete reference, but not from the abridged version:

http://processing.org/reference/index_ext.html

Processing can be thought of as a development environment and library for Java (with just a couple of syntactical niceties), so yes all the String functions are available.  StringBuffer and StringTokeniser and things should all be available too if you prefer them.

I think there is some stuff about RegExp elsewhere on this forum - possibly search for "regular expressions" if you haven't already?
Page Index Toggle Pages: 1