About 56 results
Open links in new tab
  1. What does String.substring exactly do in Java? - Stack Overflow

    May 31, 2012 · I always thought if I do String s = "Hello World".substring(0, 5), then I just get a new string s = "Hello". This is also documented in the Java API doc: "Returns a new string that is a …

  2. java - substring index range - Stack Overflow

    The substring starts at, and includes the character at the location of the first number given and goes to, but does not include the character at the last number given.

  3. java - how the subString () function of string class works - Stack Overflow

    “Substring creates a new object out of source string by taking a portion of original string”. Until Java 1.7, substring holds the reference of the original character array, which means even a sub-string of 5 …

  4. How to extract specific parts of a string JAVA - Stack Overflow

    Feb 18, 2017 · In the example code above we use the String.substring () method to gather our sub-string from within the string. To get this sub-string we need to supply the String.substring () method …

  5. Java: Getting a substring from a string starting after a particular ...

    Returns a substring after the last occurrence of delimiter. If the string does not contain the delimiter, returns missingDelimiterValue which defaults to the original string.

  6. Java - Strings and the substring method - Stack Overflow

    Apr 19, 2013 · The line 3 will create 3 new String since substring creates a new string and concatenate creates new Strings every time. String substring (int beginIndex,int endIndex) Returns a new string …

  7. java - Substring Method - Stack Overflow

    Oct 16, 2013 · It works but I thought that the substring method starts at 0 and goes from there so that substring (0,0) would include just the first letter and likewise substring (0,4) would include 0 1 2 3 4 …

  8. Función substring() dentro de Java - Stack Overflow en español

    Jul 7, 2021 · La función substring () en Java devuelve una cadena de caracteres y puede recibir uno o dos parámetros. El primer parámetro indica la posición inicial y el segundo la posición final a partir …

  9. Java substring: 'String index out of range' - Stack Overflow

    Jun 5, 2009 · 6 substring(0,38) means the String has to be 38 characters or longer. If not, the "String index is out of range".

  10. java - Why is substring () method substring (start index (inclusive ...

    Oct 29, 2014 · The second example already shows why the choice to use an inclusive start index and an exclusive end index might be a good idea: It's easy to slice out a substring of a certain length, without …