Java substring

[Java substring]

This is a memo of Java substrings that are often used in business.

Substring substring

Specify the extraction start position (beginIndex) in the first argument of the substring method and the extraction end position (endIndex) in the second argument.

Substrings start at beginIndex and represent endIndex-1.

-Example of substring

"Sample characters".substring(beginindex, endindex-1);

beginindex starts counting from 0th. Same as counting subscripts in an array.

-Character length is endIndex --beginIndex

"Sample characters".substring(0, 4);

//Output result:sample

In this case, the character length is 4-0 = 4 Therefore, 4 characters are displayed as a substring.

Recommended Posts

Java substring
Java
Java
Java memo (standard class) substring
Java inflexible String class substring
Studying Java ―― 3
[Java] array
Java protected
[Java] Annotation
[Java] Module
Java array
Studying Java ―― 9
Java scratch scratch
Java tips, tips
Java methods
Java method
java (constructor)
Java array
[Java] ArrayDeque
java (override)
java (method)
Java Day 2018
Java string
java (array)
Java static
Java serialization
java beginner 4
JAVA paid
Studying Java ―― 4
java shellsort
[Java] compareTo
java reflexes
java (interface)
Java memorandum
☾ Java / Collection
Java array
Studying Java ―― 1
[Java] Array
[Java] Polymorphism
Java review
java framework
Java features
[Java] Inheritance
FastScanner Java
Java features
java beginner 3
Java memo
java (encapsulation)
Java inheritance
[Java] Overload
Java basics
Decompile Java
[Java] Annotation
java notes
java beginner
Java (add2)
JAVA (Map)
[java] interface
Java9 collection
Java basics
Java methods