I have a string with city names separated with commas like this: {Tokyo, New York, Amsterdam}
How do you convert this to a String[] array like {"Tokyo", "New York", "Amsterdam"}
I have a string with city names separated with commas like this: {Tokyo, New York, Amsterdam}
How do you convert this to a String[] array like {"Tokyo", "New York", "Amsterdam"}
Split on ",".
String st = "Tokyo, New York, Amsterdam"
String[] arr = st.split(",");
If st
has '{' and '}'. You might want to do something along the lines of...
st = st.replace("{","").replace("}","");
to get rid of the '{' and '}'.