java - parsing a string using string tokenizer twice -


i getting input string below procedure

service:jmx:t3://10.20.30.40:9031/jndi/weblogic.management.mbeanservers.runtime 

i want parse in java , out

t3 10.20.30.40 9031 

into separate strings think can use string tokenizer have tokenize 2 times ?any better way handle this?

use jmxserviceurl class. parse url you. no need battle regex or string splits.

string url = "service:jmx:t3://10.20.30.40:9031/jndi/weblogic.management.mbeanservers.runtime"; jmxserviceurl jmxserviceurl = new jmxserviceurl(url); system.out.println(jmxserviceurl.gethost()); system.out.println(jmxserviceurl.getport()); system.out.println(jmxserviceurl.getprotocol()); 

prints

10.20.30.40 9031 t3 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -