How to solved error: Convert from string to char in Split text with C#

Hello all,

How to setup a correct split parameter in C#? Look the image & attachment bellow

image

Hello @Rpa_compara

Can you give it as “text.Split(”,“)[1]”. It will give you the value form the index 1

Hi @Rahul_Unnikrishnan

Got the same error : /

Look

I’ve actually tried it this way before, but it didn’t work : /

can you try as below.

text.Split(","c).First

text.Split(","c).Last

or

text.Split(","c)(1)

@Rahul_Unnikrishnan Those suggestions would work in VB, but doe not work in C# language : /

Do you know anyone work in C#?

Hey @Rpa_compara

I tested it in C# Project and it’s working as expected. It should work.

@Rahul_Unnikrishnan

Does not work here : /

Would you share your test file?

Is text declared as a string variable??

Yes!

Look mi file

Hi,

The following document helps you.

A character literal represents a single character, and consists of a character in quotes, as in 'a'.

So the expression should be

arrStr = yourString.Split(',',StringSplitOptions.None)

Regards,

@Yoichi

Thanks in advanced for you support, but does not work : /

I suspect it is a package update issue. Could you try in your UiPath?

Look my file with your suggestion - test.zip - Google Drive

@Rahul_Unnikrishnan

If works with you, suspect it is a package update issue. Please, could send your uipath file?

Thanks in advanced

Hi,

Please find some reference from below link

format_value.xaml (18.4 KB)

Plz find the attached file.

1 Like

Hi,

Can you try either of the following?

image

text.Split(',')

text.Split(",".ToCharArray())

text.Split(new Char[]{','})

text.Split(new Char[]{','},StringSplitOptions.None)

Regards,

1 Like

@Yoichi thanks, it worked put a “.ToSting()” in the end =)

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