I'm having problems in splitting values in java. I have a string, and this must be split using the method .split()
, but I need to return this value.
For example I have this string:
[#ff0000]red[#0000ff]blue
Now I need you to return the value FF0000 for the red, and the value 0000FF for blue.
Example:
String str = "[#FF0000]red[#0000FF]blue";
String[] ss = str.split("\\[\\#([0-9a-f]{6})\\]");
for (String s : ss) {
System.out.println(s);
}
The string is split properly, but do not know how to return the hexadecimal value. Thanks to anyone to help me.
How about first split by [ and then split by ]