android - How to assign only one value to the zeroth index of an array and that all in that array, in java -
if (uri.contains(",")) { more_than_one_url = uri.split(","); } else more_than_one_url[0] = uri; (string url : more_than_one_url) {/*operation*/}
is possible such operation 1 element in string[] or there better way this, if use different names string , string[] becomes difficult me
why check if string uri
contains ,
? split()
return string[]
if not find regex supplied. instead of checking using contains()
, this.
string[] more_than_one_url = uri.split(","); (string url : more_than_one_url) {/*operation*/}
if not find delimiter supplied, split()
return array of length 1 contain entire string.
Comments
Post a Comment