About 207,000 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 …

  2. java - Limiting the number of characters in a string, and chopping …

    int,string,double,string int,string,double,string int,string,double,string int,string,double,string and the fixed widths are: 4, 5, 6, 6. If a value exceeds this width, the last characters need to be cut …

  3. java - Generate fixed length Strings filled with whitespaces - Stack ...

    I need to produce fixed length string to generate a character position based file. The missing characters must be filled with space character. As an example, the field CITY has a fixed …

  4. Java - Create a new String instance with specified length and filled ...

    Nov 26, 2009 · This creates a List containing length-times Strings with charToFill and then joining the List into a String. String s = String.join("", Collections.nCopies(length, …

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

    Feb 8, 2018 · No matter what you do to an Array of length N (change values, null things out, etc.), it will always be an Array of length N. A String's length is incidental; it is not an attribute of the …

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

    May 3, 2009 · java.io.DataInput.readUTF() and java.io.DataOutput.writeUTF(String) say that a String object is represented by two bytes of length information and the modified UTF-8 …

  7. How do I compare strings in Java? - Stack Overflow

    Apr 2, 2013 · ==tests object references, .equals() tests the string values. Sometimes it looks as if == compares values, because Java does some behind-the-scenes stuff to make sure identical …

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

    Jan 16, 2013 · 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 …

  9. Java String Limit - Stack Overflow

    Mar 31, 2013 · There is no way to limit Strings in java to a certain finite number through inbuilt features. Strings are immutable and take the value that you provide in their constructor. You …

  10. How to format a Java string with leading zero? - Stack Overflow

    Oct 29, 2010 · In Java: String zeroes="00000000"; String apple="apple"; String result=zeroes.substring(apple.length(),zeroes.length())+apple; In Scala: …

Refresh