Remove text from string

Hello,

I need the only 3 characters before ‘—’ remove rest of the text…
example: “abc def ATA — All Time After”

in the above example i need only ATA — All Time After this part ,remove ‘abc def’

and also remove the text if there is no in the text…
eg: All Time After i want to remove the whole text…if there is no hypen…(—)

please send me the if condition for this…

Thanks,
Suresh,

Assign Activity
Name=System.Text.regularexpressions.regex.replace(“abc def ATA — All Time After”,“-”,“”).tostring

Hi @suresh_kumar4,

Check the below image, it will help you to extract the expected string from that text.

1 Like

Thanks @sarathi125 ,

Need one more help if the text does not contain ‘_’ i want to remove the whole text…
so how can i do that…

Thanks,
Suresh.

@suresh_kumar4,

Check with this,

IF(strInput.Contains("—"), strInput.Substring(strInput.IndexOf("—")-4, 3).Trim(), string.Empty)

sorry i am not getting…the output…

Thanks,
Suresh.

@suresh_kumar4,

Check the below image, and I am checking the Character you have mentioned in the initial post, not the underscore, so ensure your input is correct.

Hello,

This is working outside the for each loop…

inside the loop i am getting error…

image

can you help me on this,

regards,
Suresh

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