# How to split value after certain place

I need to split the value of x and y
For ex:{X=160,Y=220,Width=1122,Height=334}
Output should be 160
And second output should be 220

Split based on equals sign

split(yourvariable,"=")

You arrayvalue(1) contains your string value.

Regards

1 Like

Hello,

yourString.Split(",βc)(0).Split(β="c)(1).ToString gives X.

yourString.Split(",βc)(1).Split(β="c)(1).ToString gives Y.

Hope it helps !

you can use Split Function to split the string using the comma
YourString.Split(",βc)(0).Split(β=βc)(1).ToString β The output is: 160
YourString.Split(β,βc)(1).Split(β=βc)(1).ToString β The output is: 220
YourString.Split(β,βc)(2).Split(β=βc)(1).ToString β The output is: 1122
YourString.Split(β,βc)(3).Split(β="c)(1).ToString β The output is: 334

Or you can use Substring function.
YourStringVariable.Substring(StartIndex,Length)
For Example: you have the string variable: MyText = βHello Worldβ
MyText.Substring(0,2) -->This gives you the output: He
MyText.Substring(0,4) -->This gives you the output: Hell
MyText.Substring(3,2) -->This gives you the output: lo

MyText.Substring(2,3) -->This gives you the output: 160
MyText.Substring(8,3) -->This gives you the output: 220

Best regards
Mahmoud

1 Like

Your case looks like the text representation of a variable of Datatype Rectangle displayed e.g. in Locals / Watch immediate panel or ToString method.

In such case we can get the value directly from the property by the API
Have look here:

1 Like

@sruthesanju you can try regex.

Pattern for X : (?<=X=)(\d)+
Pattern for Y : (?<=Y=)(\d)+

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