You need to sign in to do that
Don't have an account?
Priyanka Reddy 74
How to convert List <String> to List of decimals
Hi All,
I have a List<String> values and i want to convert it into List<Double> or decimal.
Can some one suggest how to convert it.
Thank you.
I have a List<String> values and i want to convert it into List<Double> or decimal.
string s1 = '100,22,5'; List<String> splitDoubleValues = s1.split(','); List<Double> doubleList = new List<Double>(); for(Integer i=0;i<splitDoubleValues.size();i++){ doubleList.add(decimal.valueOf(splitDoubleValues[i])); system.debug('doubleList :'+doubleList); //selectedList3.put(doubleFeilds[i],doubleList[i]); }
Can some one suggest how to convert it.
Thank you.
I was able to use the below code and I was able to print the decimal values you can try checking this.
In the above snippet, I used for each loop instead of for loop
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.