Lets say I have a array defined in Groovy like this
def int[] a = [1,9]
Now I want to convert this array into a int variable say a1 such that a1 has the value as 19(which are the array values in the a) any way to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1) you don’t need the def:
2) What do you mean by
09? Isn’t that9? How are you seeing this encoding working?If you mean you just want to concatenate the numbers together, so;
Then you could do something like:
which converts each element into a string, joins them all together, and then parses the resultant String into an int