How to Split the string in to multiple strings and store in fix variable

Hi Team,

Need your help to split the string in to multiple strings and store in fix variable.

I have a string with address details as below:
Rajesh T
** BLOCK G-01-01**
** VIDYANAGARA 15**
** HYDERABAD**
** 51000 HYD**
** RANGAREDDY**
I want to store these information in below variables;
Owner Name
Address1
Address2
Address3
Address4
Post code City
State

The challange I am facing ,some times the address values (Address1,Address2…)will not be available in that case how i can handle the variables to store in fix variables?

Hi @RajeshT
Hope the following code will help you

StrVar = "Rajesh T
** BLOCK G-01-01**
** VIDYANAGARA 15**
** HYDERABAD**
** 51000 HYD**
** RANGAREDDY** "

ArrayOfStr = StrVar.Split( Environment.NewLine.ToArray)
if(Not ArrayOfStr(1).length=0)
{
Address1 = ArrayOfStr(1)
}
if(Not ArrayOfStr(2).length=0)
{
Address2 = ArrayOfStr(2)
}

1 Like

Hi @Mohsin_Inamdar,

Thank you for your response,the code works for me if there is string fixed but some time my string will be like below:
Example1:
"Rajesh T
** VIDYANAGARA 15**
** HYDERABAD**
** 51000 HYD**
** RANGAREDDY** "
Example 2:
"Rajesh T
** VIDYANAGARA 15**
** 51000 HYD**
** RANGAREDDY** "

How can i write the logiv in this scenario?