Selenium Question 7

Q1. If a character is not present in sting and we try to get its index what it return?


Q2. What split functions do in string class?

To split a string on the bases of space and returns a string array
String str = “ the money is here”;
String temp[] = str.split(“ “)
Temp[0] will have “the”
Temp[1] will have “money”
Now we split on the bases of is now:-
Temp[0] will have “the money”
Temp[1] will have “here”

Q3. Convert string to integer?

String x =”100”
Int i = Integer.parseInt(x);
Integer is a class and it has static function
Here Integer.parse only pass Integer
Vice verca
String z  = string.valueof(i)
For  Boolean
Boolean b= Boolean.valueof (“true”);

No comments:

Post a Comment