DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 5 of 5
  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

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links