String manipulation using split function

Hi All,

i want to split the string based on (), and written the code, but it has some error.

string img for ref
image
expression img for reference
image

Thanks in advance

@RAKESH_KUMAR_Tiwari

Please try this
CurrenRow(0).ToString.Split({"(",")"},Stringsplitoptions.RemoveEmptyEntries)

This gives array of strings

Cheers

Hi @RAKESH_KUMAR_Tiwari,

Try with this code,

yourstring.Split(New String() {"(", ")"}, StringSplitOptions.RemoveEmptyEntries)

image
This output getting.

@RAKESH_KUMAR_Tiwari ,
Try this and check

Split(Split("(UCAYIRLI)","(")(1),")")(0)

Output :
image

Regards,

@RAKESH_KUMAR_Tiwari

The output would be a array of string… you have to use (0) to get first (1) to get second and so on

Cheers

yes, type is array of string is declared only, but still error.

@RAKESH_KUMAR_Tiwari

The formula you are using and what i gave are completey different

Previously you used the correct one and it have the type system.string because you are using that in message box and it gives the type and not values

Please change properly

Cheers

Split(Split(CurrentRow(ColumnIndex).ToString,“(”)(1),“)”)(0)
or
Split(Split(CurrentRow(“ColumnName”).ToString,“(”)(1),“)”)(0)

Enter the column index or column name from the datatable. The Index starts from 0

i am trying different different method, but still no success.


this gives me compiler error, end of expression.

@RAKESH_KUMAR_Tiwari

Can you please try the above give expression

That should work to split…

Cheers

Replace myText with ur desired string

  1. myText = “Ugurl123(UCAYIRL)” in ur case currentrow.tostring
  2. result = myText.Split(“(”)(1)
  3. result = result.Remove(result.Length - 1)

image

yes expression followed,


still error

please use Text to left/Right activity from the activities pannel and provide a custom separator in it!

image

1 Like

Hey!

If you want to get the data between the braces you can try this:

StrData = System.Text.RegularExpressions.RegEx.Match(strInputVariable,"(?<=\().+(?=\))").ToString.Trim

Reference:

Regards,
NaNi

@RAKESH_KUMAR_Tiwari

The above is the given expression…and what i see in screenshot is completely different

Cheers

Hi @THIRU_NANI ,

i already tried regex, but it gives me null value.

Hey!

Try the above given one.

It will work.

Regards,
NaNi

same, it gives me null value.