About 1,370,000 results
Open links in new tab
  1. java - Get string character by index - Stack Overflow

    For more information, see the Java documentation on String.charAt. If you want another simple tutorial, this one or this one. If you don't want the result as a char data type, but rather as a …

  2. java - How do I get the last character of a string? - Stack Overflow

    Mar 2, 2011 · You've got several questions mixed up together. Broadly, yes, str.charAt(str.length() - 1) is usually the last character in the string; but consider what happens if str is empty, or null.

  3. Java - Why can't I use charAt() to see if a char equals another?

    In your original version, "f" is a String and fieldNames.charAt(4) is a char, and you cannot compare a String with a char using ==. If you write 'f' instead of "f" (as above) you will be …

  4. java - Take a char input from the Scanner - Stack Overflow

    Dec 19, 2012 · char charAtAnyPos= input.charAt(pos); // in pos you enter that index from where you want to get the char from By the way, you can't take a char directly as an input.

  5. Convert character to ASCII numeric value in java - Stack Overflow

    May 9, 2013 · The Unicode character set is a super set of ASCII. So there can be characters in a Java string that do not belong to ASCII. Such characters do not have an ASCII numeric value, …

  6. java - How to use something like the charAt for integers - Stack …

    Sep 30, 2015 · I am trying to make a program that uses three digit numbers to identify items and I am trying to use something like the charAt method for integers or something.

  7. java - How to convert a char to a String? - Stack Overflow

    Nov 17, 2011 · } Source code from String.java in Java 8 source code Hence String.valueOf(char) seems to be most efficient method, in terms of both memory and speed, for converting char to …

  8. How String.charAt(int i) is implemented in Java? - Stack Overflow

    Apr 26, 2014 · If I want to check every char in a String using String.charAt(int i), would it count from start every time or it is converted to an array automatically and get the charAt index directly?

  9. What's the difference between string [i] and string.charAt (i) in …

    In Java, string[i] is not the i th index of the string. Instead, if you had defined string as an array (e.g., String[] string = new String[10]), then string[i] would refer to the i th element in the array.

  10. Java charAt() or substring? Which is faster? - Stack Overflow

    String.charAt (i) does that lookup as far as I am aware. Copying the string to a new array (which is what I understand String.toCharArray () to do) introduces a new and different overhead. Is …