hello all
i have a string *354*4*string#.what i want is to fetch the string and calculate it's length.

plz help

what i mean is string is a mobile no which is entered by user.i want to check the length of it so that arrayIndex out of bound exception can be handled.that why i want fetch enterd moblie no and check it's length.
what i m using for this is

if(length > 12)
        {                //*354*4*9061239405#
                 strRequest = strRequest.substring(7,length-1);
                System.out.println(strRequest);
        }

but sometime when user enter *354*4*96034# then it will give Indexoutof bound exception.I want to print some error message instead of this

Then take the length of the String and use if-else statements as when to call the substring method. The variable length, how do you give it value? Shouldn't be using the String API in order to get the length of the String ?

thanks buddy.I hv solved it

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.