Create a char from an int value.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Create a char from an int value.

  1. #1
    Join Date
    Apr 2004
    Posts
    3

    Create a char from an int value.

    I have an int value, say 68, and I want to turn it into the char "a".

    I tried
    char c = new char(68);

    Is it a method in the Integer class. Any help would be appreciated.

  2. #2
    Join Date
    Feb 2004
    Posts
    541
    try this
    Code:
    int myInt = 68;
    char myChar = (char)myInt;
    That gets an integer value and casts it into a char.

  3. #3
    Join Date
    Apr 2004
    Posts
    3
    Thanks for the help. I'll have to try it when I get home.

  4. #4
    Join Date
    Mar 2004
    Posts
    635
    That just uses the ASCII value right?

  5. #5
    Join Date
    Feb 2004
    Posts
    541
    yes, as far as i know. 68 is D

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