i having the string array,, String[] strrr=null; String[] aa ;
aa=strrr[3].split("\!"); if i debug this it shows source not found
but i want to return from the string if the strrr[3] value having
null or 0 ,how to do it,, use above three line of code to check
it,exactly what i want is i dont want any exceptions at the third
line of above , how to do it

Recommended Answers

All 4 Replies

1) strrr object isnt intialized yet, u have initialze it first.
strrr = new String[size];
2) Now u can check your string, if its null dont split.

actually i got string from server so i want to check the string is null or not , how to do it

aa=strrr[3].split("!");

i want to check strr[3] is null or not

All yu need is if (strr[3] == null)
... but if strr has not been initialised or is less than 4 elements in size you will need to deal with those possibilities before trying to use strr[3]

1) Check wether main string is null (if(str != null)) then
2) After that get the length of Str, if it is more then 3 then check if(str[3] == null) then
.........................................................................................

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.