If your string contains exactly one character the simplest way to convert it to a character is probably to call the charAt
method:
char c = s.charAt(0);
More Related Contents:
- incompatible types required char found java.lang.string
- Can I product of charAt in Java? [duplicate]
- How to replace a char with a string
- String index out of range in jva
- Why is char[] preferred over String for passwords?
- Java: parse int value from a char
- How to parse a mathematical expression given as a string and return a number? [duplicate]
- In Java, how do I parse XML as a String instead of a file?
- Check string for palindrome
- How to convert a char to a String?
- How to convert a char array back to a string?
- How can non-ASCII characters be removed from a string?
- Putting char into a java string for each N characters
- Fastest way to iterate over all the chars in a String
- Isn’t the size of character in Java 2 bytes?
- How to check that a string is parseable to a double? [duplicate]
- Difference between “char” and “String” in Java
- The concatenation of chars to form a string gives different results
- Extract Integer Part in String
- Evaluate String as a condition Java
- In Java, how to find if first character in a string is upper case without regex
- How do I check if a char is a vowel?
- How do I apply the for-each loop to every character in a String?
- How can I parse a String to BigDecimal? [duplicate]
- Find all words with 3 letters with regex
- Illegal Escape Character “\”
- Replace a character at a specific index in a string?
- Why StringBuilder when there is String?
- Looking for a CSS Parser in java [closed]
- Java : Convert formatted xml file to one line string