String processor?

Does anyone have a tutorial on string processing? I’m currently working on an RPG and the string processor I have made doesn’t always produce good results. For example it cuts out a letter or maybe a whole word. So any tutorial would help to be honest. Thanks!

edit:

Okay here is my main problem

http://i1116.photobucket.com/albums/k577/jay4842/Untitled.png

it cuts off letters, for example it was supposed to say outer space, but it cut out the u. I realize now that I misspelled that but, thats my main issue. I take a string and split it into two strings. but when I do that it cuts out some things.

Also thank you for the feedback!

Use split to split by every space like this:

String myString = "Hello World";
String[] words = myString.split(' ');

returns [icode][0]Hello [1]World[/icode]

Use split to split by every character like this:

String myString = "Hello World";
String[] characters = myString.split('.');

returns [icode][0]H[1]e[2]l[3]l … [/icode]

Look up the docs for regex to find how to split more specific strings.

String processing is a quite wide field (try googling for it), suggest you provide a couple of examples of what you’re hoping to achieve and someone should be able to offer some thoughts, tutorials, libraries, etc.

String processing? The only way I can think of processing strings are regular expressions, it’s not very wide. They’re pretty easy to use too.

Googling string processing will get you the programming language “processing” on how to use strings… Regex is what OP is looking for.

“String processing” is indeed very wide- are we talking about parsing xml? Taking commands from a user? Setting up properties? Natural language processing? Generating in-game dialogue? Something else?

Even “use regular expressions” is pretty wide.

We need to know more information from OP: what kinds of Strings are you trying to “process”? Exactly what do you want to happen? What have you tried so far?

I probably should have worded that better, and sounded less like an asshole xD. Sorry StrideColossus, have a medal

You’re right, string processing is pretty wide in a way for the definition could be. I was looking at “ways for sorting characters in strings”. But code relating strings in general… There’s only so much Regex can do, and Java can substitute those pretty easily with a few shortcuts.

OP said earlier

He’s mainly looking to sort strings… Regex is useful for that kind of stuff. He’s just googling the wrong things.

I, and I’ll bet others, have no idea where you extrapolated that meaning from that quote. OP needs to define an actual problem.

No offence taken :slight_smile:

And yes regex is possibly something the OP should be looking at.