append character


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: append character

  1. #1
    Join Date
    Mar 2006
    Posts
    8

    append character

    hi all;

    i have a probelm to append character become a string. for instance:

    char first, second, third;
    String theword;
    for(char r = 'a'; r <= 'z'; r++){
    first = r;
    for(char s = 'a'; s<='z'; s++){
    second = s;
    for (char t = 'a'; t <= 'z'; t++){
    third = t;
    theword = first + second + third;
    }
    }
    }


    I want to print 'first + second + third' but i have problem to convert char into string. how actually can i convert char to string or it is possible for me to convert it? does any can give some hints or give me a related website so that can refer to it?

    i really appreaciate anyone's help! thanx in advance!

    regards;
    dulcinea

  2. #2
    Join Date
    Feb 2006
    Location
    Cologne - Germany
    Posts
    271
    Use theword = first +""+ second +""+ third;
    doing first+second the compiler interprets the characters as chars and thus as numbers. adding an empty string will cast the chars to a string.
    by the way: for loops with characters are not that nice. use something like that:
    Code:
    final String chars = "abcdefghijklm...";
    for (int i=0; i<chars.length; i++){
      char anychar = chars.charAt(i);
    }

Similar Threads

  1. Replies: 1
    Last Post: 09-17-2008, 04:19 AM
  2. Microsoft's C++ bigotry
    By Phil Weber in forum .NET
    Replies: 632
    Last Post: 10-01-2003, 01:00 AM
  3. Replies: 2
    Last Post: 06-21-2001, 05:58 AM
  4. Append Queries?
    By Bryan in forum VB Classic
    Replies: 3
    Last Post: 07-14-2000, 10:44 AM
  5. Append Queries?
    By Bryan in forum VB Classic
    Replies: 1
    Last Post: 06-28-2000, 01:56 PM

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