DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2006

    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!


  2. #2
    Join Date
    Feb 2006
    Cologne - Germany
    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:
    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, 03:19 AM
  2. Microsoft's C++ bigotry
    By Phil Weber in forum .NET
    Replies: 632
    Last Post: 10-01-2003, 12:00 AM
  3. Replies: 2
    Last Post: 06-21-2001, 04:58 AM
  4. Append Queries?
    By Bryan in forum VB Classic
    Replies: 3
    Last Post: 07-14-2000, 09:44 AM
  5. Append Queries?
    By Bryan in forum VB Classic
    Replies: 1
    Last Post: 06-28-2000, 12: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
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

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

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.