How can I add 2 heights?

I am new to UIpath, please help me
after getting the height from get CSS value, how to add those 2 heights.

Hello @Kien_Vu Welcome to Ui[path Community
Kindly share some input and expected output.

If you are using get attribute activity and get the data as a string but it is number, use

cint(Yourstring1)+cint(YourString2)
1 Like

Thank you for answering my question
For example
when taking 1 height from divA tag called A1 and the result is: 500px
and the div tag B called B1 and the result is: 100px
when i do the addition it results in: 500px100px
how to make the result to 600px

Hi @Kien_Vu, welcome to UiPath Community, after getting both heights you have to remove px from numbers using regex,
Regex Link:

Then you have to convert both values into Integer and then add these values together, It will work

Regards:
Hafiz Mohammad Ahsan

1 Like

@Kien_Vu, if you don’t want to use Regex, just simply split the string and separate last two words “px” from it and then convert values into Integer

1 Like

(post deleted by author)

Thank you for sharing useful information

Hi @Kien_Vu ,

You could try Replacing px as well and Check if this holds good for your case :

CInt("600px".Replace("px",""))+CInt("500px".Replace("px",""))
1 Like

@Kien_Vu Kindly try this

A=500px
B=100px

A1=System.Text.RegularExpressions.Regex.Match(A,"\d+").Tostring.trim

B1=System.Text.RegularExpressions.Regex.Match(B,"\d+").Tostring.trim
Output=Cint(A1)+Cint(B1)
1 Like

thanks everyone

No problem

image

1 Like

thank you so much