How to ADD(calculation) decimals numbers in string

Hello Smart People

I have a string array{“10.00”, “10.05”, “10.50”} and add all those decimal numbers.
I like to get the output like “30.55”
i do not know how to add decimal numbers , those are in string type.


Thank you in advance.

@eimon You can directly calculate the Sum from the String Array like below.

strArray = {"10.00","10.05","10.50"}
totalSum = strArray.Sum(Function(x)CDbl(x)).ToString

Where totalSum is a String Variable

2 Likes

In your workflow
you can do the following modifications

  1. before the loop, use the assign activity to intialise a double variable sum =0
  2. iniside the loop use the below assign activity only

sum= sum+CDbl(item)

@supermanPunch Hello

Thank you for your quick answer. It works.
May i know which website should i go to study because i am new to Uipath and do not know VBA. My first time seeing CDbl here honestly. if you have time please guide us. Thank you.
eimon

CDbl is a function used to conversion to decimal number

@eimon

Check this for reference

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.