File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to find String array length

 
Mahi Ranga
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic