aspose file tools
The moose likes Java in General and the fly likes how to find String array length Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "how to find String array length" Watch "how to find String array length" New topic
Author

how to find String array length

Mahi Ranga
Ranch Hand

Joined: Jan 27, 2011
Posts: 33
Hi,
i am facing one problem i.e finding String array length.
my program is :

String str="12345678,12345679";
String arr[]=str.split(",");
when i am printing arr.length it is giving 2.but i want 8 and 8.
Mohamed Sanaulla
Bartender

Joined: Sep 08, 2007
Posts: 2926
    
  15

Did you try- arr[0].length() and arr[1].length()?

arr is an array of Strings and you want the length of the Strings and not the length of the array.


Mohamed Sanaulla | My Blog
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: how to find String array length
 
Similar Threads
arg.length
Comparing Arrays
array
Fixed-length numbers and strings
questions from java prepare