0
What is sub.string() ? In java
20 Respostas
+ 2
You are looking for something like this?
String str= new String("quick brown fox jumps over the lazy dog");
System.out.println("Substring starting from index 15:");
System.out.println(str.substring(15));
System.out.println("Substring starting from index 15 and ending at 20:");
System.out.println(str.substring(15, 20));
+ 2
String a = "Learning java is fun";
System.out.println(a.substring(1,8));
From index 1 to index 8-1
So it will print "earning"
Edit: It will not print the character at the index 8.
+ 1
Yes, that's what it should do.
It's Java's Substring function.
But if you know that, what's your question?
+ 1
+ 1
Deena Dhayalan.S exactly
0
it returns part of string
String str = "my string";
System.out.println( str.substring(0,6) ); //my str
0
Lol, zemiak you are not the TO 😂
0
@Thomas I want to know who it's work!?😅 Can you explain
0
zemiak bro I can't understand!!
It is found by index!!
0
Yes, it works by Index.
Look at the example I have postet above.
You will get a substring
1. from start index to end of String.
Or:
2. From start index to end index
0
Then what will be out for that!?
0
Output for the exames above:
Substring starting from index 15:
jumps over the lazy dog
Substring starting from index 15 and ending at 20:
jump
0
Ohh tq Thomas 😍...
0
String a= "abcd";
System.out.println(a.substring(2));
Output : cd
Or : c only!!?
0
Avinesh so if we didn't mention the end string index then it will show till the end!?
0
Tq bro Avinesh 😍...
0
Or are you trying to convert a variable sub from another data type to a string datatype?
0
Gduhvt479,;'%-
0
Чеееее