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

    String text = "foo"; char charAtZero = text.charAt(0); System.out.println(charAtZero); // Prints f For more information, see the Java documentation on String.charAt. If you want another simple …

  2. 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.

  3. 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.

  4. 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 …

  5. What is the easiest/best/most correct way to iterate through the ...

    Jan 6, 2017 · There are a countless ways to write, and implement, an algorithm for traversing a string, char by char, in Java. Which one is most correct, easist, and most simple are 3 different …

  6. How can I enter "char" using Scanner in java? - Stack Overflow

    Apr 16, 2014 · I have a question how can I enter char using Scanner in java? Such as for integer number Scanner input=new Scanner(System.in); int a = input.nextInt(); but how can I do the …

  7. parsing - Java: parse int value from a char - Stack Overflow

    Feb 11, 2011 · See this code run live at IdeOne.com. 5 char is legacy Avoid using char. This type was legacy as of Java 2, essentially broken. As a 16-bit value, the char / Character type …

  8. Java String/Char charAt() Comparison - Stack Overflow

    Oct 17, 2016 · In Java, all characters are actually 16-bit unsigned numbers. Each character has a number based on it unicode. e.g. '9' is character (char) 57 This comparison is true for any …

  9. 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?

  10. 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, …