Converting array to String


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Converting array to String

  1. #1
    Join Date
    May 2005
    Posts
    115

    Converting array to String

    I have a 2 dimensional array, screen[][] which i want to convert into String and print.

    Code:
    	
    public String toString(){
    		String z=z.copyValueOf(screen);
    		return z;
    	}
    I know the code above is wrong, how should i code it?

  2. #2
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    Code:
    StringBuffer sb=new StringBuffer();
    public String toString(){
      sb.setLength(0);
      for (int i=0; i<screen.length; i++) {
        for (j=0; j<screen[i].length; j++) {
          sb.append(screen[i][j]);
        }
      }
      return sb.tostriing();
    }
    eschew obfuscation

Similar Threads

  1. Input string was not in a correct format
    By mdengler in forum ASP.NET
    Replies: 0
    Last Post: 11-26-2002, 02:32 PM
  2. Replies: 1
    Last Post: 06-05-2001, 06:12 AM
  3. verify local admin
    By Patrick Comeau in forum VB Classic
    Replies: 6
    Last Post: 03-22-2001, 10:50 PM
  4. Please help me -- urgent -- deadlock error
    By chandra in forum VB Classic
    Replies: 0
    Last Post: 06-22-2000, 07:36 AM
  5. Database problems
    By Robert Rieth in forum VB Classic
    Replies: 1
    Last Post: 04-11-2000, 03:21 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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center