samedi 16 juillet 2016

Splitting string in between two characters in Java

I am currently attempting to interpret some code I wrote for something. The information I would like to split looks something like this:

{hey=yes}TEST

What I am trying to accomplish, is splitting above string in between '}' and 'T' (T, which could be any letter). The result I am after is (in pseudocode):

["{hey=yes}", "TEST"]

How would one go about doing so? I know basic regex, but have never gotten into using it to split strings in between letters before.

Update:

In order to split the string I am using the String.split method. Do tell if there is a better way to go about doing this.

Aucun commentaire:

Enregistrer un commentaire