Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

Getting lenght of String array

Hi,

How can i find the lenght of a string array, i have used length method to calculate length of single string value,e.g

String value = "test"

int length = value.length()

Now i want to calculate length of a string array.e.g

String csv_values = "test,by,random"

String[] str = csv_values.split(",")

int lenght = str.length()

As you can see i want to calculate total number of entries in an array after i split it dynamically.

Currently it is giving me exception, "Unable to parse exception; Undefined method: length for class: [Ljava.lang.String]"

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Getting lenght of String array

This is a tricky one.  An Array has a length property, unlike a String which has a length method.

So...

int length = str.length

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
1 REPLY

Re: Getting lenght of String array

This is a tricky one.  An Array has a length property, unlike a String which has a length method.

So...

int length = str.length

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
201
Views
0
Helpful
1
Replies