About 51 results
Open links in new tab
  1. How to correctly compute the length of a String in Java?

    The normal model of Java string length String.length() is specified as returning the number of char values ("code units") in the String. That is the most generally useful definition of the length of a Java …

  2. arrays - length and length () in Java - Stack Overflow

    Dec 27, 2009 · Why do we have the length of an array as an attribute, array.length, and for String we have a method, str.length()? Is there some reason?

  3. java - When to use .length vs .length () - Stack Overflow

    But when you are using people[i].length(), you are accessing the string at that position of the array, and getting the length of the string, therefore using the .length() method in the String class. However, just …

  4. java - Difference between size and length methods? - Stack Overflow

    Nov 25, 2013 · size() is a method specified in java.util.Collection, which is then inherited by every data structure in the standard library. length is a field on any array (arrays are objects, you just don't see …

  5. java - Limiting the number of characters in a string, and chopping off ...

    1248 diffe 22.348 montre I am thinking I need to do something in the constructor that forces a string not to exceed a certain number of characters. I will probably cast the doubles and ints to a string, so I …

  6. java - Check if string length entered is equal to three - Stack Overflow

    I need to create a code that checks if the input from the user is equal to a double literal length 3. my if statement is where i am having trouble. Thanks Scanner stdIn= new Scanner(System.in); S...

  7. String's Maximum length in Java - calling length () method

    May 3, 2009 · Considering the String class' length method returns an int, the maximum length that would be returned by the method would be Integer.MAX_VALUE, which is 2^31 - 1 (or approximately 2 …

  8. Java String array: is there a size of method? - Stack Overflow

    May 28, 2009 · I come from a php background and in php, there is an array_size() function which tells you how many elements in the array are used. Is there a similar method for a String[] array? Thanks.

  9. How many characters can a Java String have? - Stack Overflow

    Jul 24, 2009 · Java 9 is going to use a single byte per character for strings having only iso-latin-1 content, so such strings can have as many characters as the heap in bytes (or max array length, …

  10. Split string to equal length substrings in Java - Stack Overflow

    Sep 21, 2010 · 158 How to split the string "Thequickbrownfoxjumps" to substrings of equal size in Java. Eg. "Thequickbrownfoxjumps" of 4 equal size should give the output.