Recently, I have found out about the Wavefront OBJ format, which uses a pretty simple text pattern. Below is a given example.
[source lang="plain"]# Blender v2.63 (sub 0) OBJ File: ''# www.blender.orgmtllib pyramid.mtlo Cubev 0.833333 -0.291667 -1.166666v 0.833333 -0.291667 0.833333v -1.166667 -0.291667 0.833333v -1.166666 -0.291667 -1.166667v -0.166667 1.458333 -0.166667v 0.833333 -0.291667 0.833334usemtl Materials offf 1 2 3 4f 6 1 5f 5 3 6f 3 5 4f 5 1 4[/source]
I have decided to work my text pattern based around the OBJ format, shown above, so it kind of looked like this:
[source lang="plain"]#1 title:"This is a title." msg:"This is a message."#2 title:"This is something else." msg:"This is fun to read."#3 title:"This is wrong." msg:"This is nice."#4 title:"t" msg:"m"[/source]
I was wondering if anyone else have insights on this. As far as I know, text parsing is one thing, but creating a custom pattern is another. Thanks in advance.
EDIT: I realized I made a mistake in choosing the text pattern I posted above. The downside of this text pattern, is that you can't concatenate String tokens broken up by one or more newlines. If some monologues / dialogues have extended text messages, the only way to make it work is to turn off Text Wrapping in some text editors. Are there other ways I could do this, by adding in newlines and stuff?
I did use the String.split() method, but as far as I know, it doesn't seem to work on newlines. Unless there's a better way to fix this, I'm not quite sure.
Edited by tom_mai78101, 05 September 2012 - 04:04 AM.