File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Java
»
Beginning Java
Author
How to convert a String to char
Ramakrishna Gummadi
Greenhorn
Joined: Jun 29, 2011
Posts: 16
posted
Sep 11, 2011 09:22:59
0
Hello friends
I want to know that how to convert a
string
value and store into char value.
ex:-
String str="A";
now i want to store in char ch;
thanks in advance....
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
Sep 11, 2011 09:47:18
2
Check out the String.charAt and String.toCharArray methods.
Android apps
–
ImageJ plugins
–
Java web charts
Gihan Pandigamage
Ranch Hand
Joined: Aug 23, 2009
Posts: 57
posted
Sep 15, 2011 03:58:13
0
String str = "A";
char ch= str.charAt(0);
System.out.println(ch);
Ramakrishna Gummadi
Greenhorn
Joined: Jun 29, 2011
Posts: 16
posted
Sep 15, 2011 08:53:02
0
gihan pandigamage wrote:
String str = "A";
char ch= str.charAt(0);
System.out.println(ch);
Thank you dude....
Ove Lindström
Ranch Hand
Joined: Mar 10, 2008
Posts: 326
I like...
posted
Sep 16, 2011 01:51:38
0
gihan pandigamage wrote:
String str = "A";
char ch= str.charAt(0);
System.out.println(ch);
Or faster...
char ch = 'A';
;)
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: How to convert a String to char
Similar Threads
String to char.
How do I convert a String to a char?
Convert "\n" to char '\n'
convert Hex to Char or Dec
const char * to string
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter