Help in Split String activity

Hi Guys,

I want to split string, The below is the sting i want to split.

Get this document done - Please finish it before - 4.

Result: Please finish it before - 4

1 Like

Split(“Get this document done - Please finish it before - 4.”,“done -”).Last

Hi @arivazhagan_mathivan,

you can simply replace text(Get this document done - ) with null.

Str1.Replace("Get this document done - ","")

Hi @arivazhagan_mathivan,

You can get the value by using String.Replace

Str1 = "Get this document done - Please finish it before - 4."

Str1 = Str1.Replace("Get this document done - ","")

Hi @arivazhagan_mathivan

Try the below code

strArr = “Get this document done - Please finish it before - 4.”.Split("-"c)
strVal = string.Join(string.Empty,strArr.Except(new string(){strArr(0)}).ToArray())

Hi All,

Thanks for your response,

Im having this value in datatable row.item(1). im using below expression.

The string i want to split Get this document done - Please finish it before - 4.

Expression im using row.item(1).tostring.split("-",c)(1).trim
Result im getting Please finish it before

But i want Please finish it before - 4.

@arivazhagan_mathivan

Try this:

row.item(1).tostring.split("-",c)(1).trim+"-"+row.item(1).tostring.split("-",c)(2).trim

Try as below code, assign the split string into a variable strArr

strArr = row.item(1).tostring.Split("-"c)
strVal = string.Join(string.Empty,strArr.Except(new string(){strArr(0)}).ToArray())

index was outside the bounds of the array
this is the issue im facing

Try this
variable1="Get this document done - Please finish it before - 4"
variable1.Substring(Variable1.IndexOf("-")+1)

Hi
kindly try with this expression if this input is in variable str_input
str_output = System.Text.RegularExpressions.Regex.Match(str_input.ToString,"(?<=-).*").ToString.Trim

it worked as well
image

Cheers @arivazhagan_mathivan

@arivazhagan_mathivan

Try this :

row.item(1).tostring().Substring(row.item(1).tostring().IndexOf(“Please”))