Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java.lang.stringindexoutofboundsexception: string index out of range: 10

The type of exception thrown is a StringIndexOutOfBoundsException. Anytime you get an IndexOutOfBoundsException (or any type thereof) it means that you are trying to access an index in an array that doesn't exist. By calling the substring method, you are dividing the string in a character array, and selecting characters A to B (In your case 0 to 1). If character 1 doesn't exist, and yet you try to access it, it will throw this error.

The reason you are getting this error is therefore that you are trying to execute a substring(0,1) on a String with less than 1 character, aka an empty string or even a null string maybe.
Comment

PREVIOUS NEXT
Code Example
Java :: java method exercises 
Java :: java join array 
Java :: ascii values to display certain characters in java 
Java :: call activity method from adapter 
Java :: final class java 
Java :: Get the number of weeks between two dates 
Java :: arraylist add at index 
Java :: java final class 
Java :: how to create a boolean list in java 
Java :: calling a method in java 
Java :: java reverse array 
Java :: remove java ubuntu 20.04 
Java :: for var i = 0 
Java :: public class extends implements java 
Java :: reverse an android application 
Java :: why does the ribbon dependency crush my app 
Sql :: delete all nodes neo4j 
Sql :: oracle change nls_date_format permanently 
Sql :: psql drop column 
Sql :: wait delay in sql server 
Sql :: print oracle 
Sql :: postgresql blocked on mac 
Sql :: search stored procedures 
Sql :: mysql change database charset and collation 
Sql :: pdo mysql insert 
Sql :: oracle select first 10 rows 
Sql :: find table for column name in sql 
Sql :: sql error 1175 
Sql :: set database timezone mysql 
Sql :: su: Authentication failure mysql 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =