Split String after character

Hello everyboby,

I Want split my string for take all after “R”.
I use ---- > row(“N° DA”).ToString.Split("R"c)(1)

But he dos’nt work …

Help me, Thank !

@mateo.drouillard

It’s better if you can share a sample excel and your workflow
So, that we can try to check your issue

Thanks

Hi @mateo.drouillard

Try this expression

Split( row(“N° DA”).ToString,"R")(1)

image

Regards
Gokul

Thank !
image

I have this error

Assign: Index was outside the bounds of the array.

Hi @mateo.drouillard

Try to use TRIM in the expression

Split( row(“N° DA”).ToString.Trim,"R")(1)

image

Regards
Gokul

1 Like

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Match(row("N° DA").ToString,"(?<=R).*").Value

Regards,

1 Like

Thank Yoichi it work.

But is very long, have you idea for speed up ?

Same error …

Hi,

The following will also work. Can you try these?

row("N° DA").ToString.Substring(row("N° DA").ToString.IndexOf("R")+1)

(If there is no “R” in the string, returns whole string)

OR

row("N° DA").ToString.Substring(if(row("N° DA").ToString.Contains("R"),row("N° DA").ToString.IndexOf("R")+1,row("N° DA").ToString.Length))

(If there is no “R” in the string, returns empty string)

Regards,

1 Like

Here is how I would do it:

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