Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

problem while converting String to List in Java..

I am trying to convert the below string to a list in Java, but its taking as a single object, I need four separate obejcts.


String:

button 1 of window "abc" of application process "xyz" button 2 of window "abc" of application process "xyz" button 3 of window "abc" of application process "xyz" button "Finish" of UI element 1 of scroll area 1 of window "abc" of application process "xyz"



Java code used:



List<String> items = Arrays.asList(resultObject.toString().split("\\s*,\\s*"));
    List<String> formattedList = new ArrayList<String>();
    for (String item : items) {
        formattedList.add(item);                        
    }

Expected Output:

similar to string but in four different list objects



item1 : button 1 of window "abc" of application process "xyz"
    item2 :button 2 of window "abc" of application process "xyz"
    item3: button 3 of window "abc" of application process "xyz"
    item4 :button "Finish" of UI element 1 of scroll area 1 of window "abc" of application process "xyz"

Mac OS X (10.7.4)

Posted on Nov 14, 2012 1:55 AM

Reply

There are no replies.

problem while converting String to List in Java..

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.