Results 1 to 2 of 2
  1. #1
    elenora is offline Member
    Join Date
    Apr 2011
    Posts
    30
    Rep Power
    0

    Cool How to convert array of Objects into array of Strings

    Hi,
    I have an array which is type of Object and it's contents are Strings! I want to put it's contents into an array which is type of String, to convert them I have used toString() method but when I want to use the content of the String Array it's contents are printend wrong!I appreciate if anyone tell me, How could I convert Object into String?

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    6

    Default

    Iterate over the first array and put them into the second one?
    Or use the copyOfRange method?
    String[] stringArray = Arrays.copyOfRange(objectArray, 0, objectArray.length, String[].class);


Similar Threads

  1. convert byte array into char array
    By kgkamaraj in forum New To Java
    Replies: 4
    Last Post: 09-13-2011, 11:32 AM
  2. array containing int strings
    By ggalan in forum New To Java
    Replies: 19
    Last Post: 04-22-2011, 04:40 PM
  3. extract strings from an array
    By plasticfood in forum New To Java
    Replies: 18
    Last Post: 10-02-2010, 01:15 PM
  4. Strings as array help please..
    By crazygurl in forum New To Java
    Replies: 1
    Last Post: 12-01-2009, 08:23 PM
  5. Convert Char Array to String Array
    By Mayur in forum New To Java
    Replies: 8
    Last Post: 10-12-2009, 11:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •