Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Post Reopened by Pshemo, Bill the Lizard
added 362 characters in body
Source Link
Badmiral
  • 1.6k
  • 4
  • 38
  • 77

I have a string like this:

String unparsed = "[thing.1][thin2g]" 

I want to turn it into

"thing.1" "thin2g" 

Been trying for a while with regex expressions but nothing. Any thoughts? Thanks!

EDIT:

Tried:

String unparsed = "[thing.1][thin2g]" String substring = unparsed.substring(1,unparsed.length - 1) substring.replace("][","`") String[] split = substring.split('`') for(int i=0;i<split.length;i++) { System.out.println(split[i]) } 

But this seems kinda heavy, was looking for something more elegant

I have a string like this:

String unparsed = "[thing.1][thin2g]" 

I want to turn it into

"thing.1" "thin2g" 

Been trying for a while with regex expressions but nothing. Any thoughts? Thanks!

I have a string like this:

String unparsed = "[thing.1][thin2g]" 

I want to turn it into

"thing.1" "thin2g" 

Been trying for a while with regex expressions but nothing. Any thoughts? Thanks!

EDIT:

Tried:

String unparsed = "[thing.1][thin2g]" String substring = unparsed.substring(1,unparsed.length - 1) substring.replace("][","`") String[] split = substring.split('`') for(int i=0;i<split.length;i++) { System.out.println(split[i]) } 

But this seems kinda heavy, was looking for something more elegant

Post Closed as "Not suitable for this site" by ruakh, Pshemo, Hovercraft Full Of Eels, Jayamohan, Stephen C
Source Link
Badmiral
  • 1.6k
  • 4
  • 38
  • 77

Java Parsing of a String

I have a string like this:

String unparsed = "[thing.1][thin2g]" 

I want to turn it into

"thing.1" "thin2g" 

Been trying for a while with regex expressions but nothing. Any thoughts? Thanks!