About 184,000 results
Open links in new tab
  1. java - How to convert a char to a String? - Stack Overflow

    Nov 17, 2011 · String(char[] value, boolean share) { // assert share : "unshared not supported"; this.value = value; } Source code from String.java in Java 8 source code. Hence …

  2. Concatenate chars to form String in java - Stack Overflow

    If the size of the string is fixed, you might find easier to use an array of chars. If you have to do this a lot, it will be a tiny bit faster too. char[] chars = new char[3]; chars[0] = 'i'; chars[1] = 'c'; …

  3. Converting String to "Character" array in Java - Stack Overflow

    Apr 4, 2012 · String givenString = "MyNameIsArpan"; char[] givenchararray = givenString.toCharArray(); String.valueOf(givenchararray).chars().mapToObj(c -> …

  4. java - How to convert a char array back to a string ... - Stack …

    Apr 11, 2015 · A String in java is merely an object around an array of chars. Hence a. char[] is identical to an unboxed String with the same characters. By creating a new String from your …

  5. How do I use the character's equals() method in Java?

    Sep 1, 2018 · It depends on using a primitive type, char, int, etc. And using Objects like String. A primitive type like an int can be compared 1 == 1 and if you check 2 objects to each other …

  6. How to convert/parse from String to char in java?

    Oct 21, 2011 · If you want to parse a String to a char, whereas the String object represent more than one character, you just simply use the following expression: char c = (char) …

  7. java - Most efficient way to make the first character of a String …

    Oct 29, 2010 · What is the most efficient way to make the first character of a String lower case? I can think of a number of ways to do this: Using charAt() with substring() String input = …

  8. java - Create a string with n characters - Stack Overflow

    May 11, 2010 · char[] charArray = new char[length]; Arrays.fill(charArray, ' '); String str = new String(charArray); Of course, I assume that the fill method does the same thing as your code, …

  9. How to capitalize the first letter of a String in Java?

    Oct 11, 2010 · I am using Java to get a String input from the user. I am trying to make the first letter of this input capitalized. I tried this: String name; BufferedReader br = new …

  10. java - First char to upper case - Stack Overflow

    Jul 13, 2012 · What you want to do is convert the string to an array using the String class' charAt() method, and then use Character.toUpperCase() to change the character to upper case …

Refresh