How to create a list of strings from 1 long string

Hi everyone

I have a long string that have a “,” between each couple of chars
and I want to create a list of strings, that each string will be those chars between the “,”
Example:
“asdf asdf asdf, asdfasdf asdfasdf asdf, asdfas asdf asdfre, werg ethjer rtherrh” and so on
and I want it to give:
{“asdf asdf asdf”, “asdfasdf asdfasdf asdf”, “asdfas asdf asdfre”, “werg ethjer rtherrh”}
I want all this so I could create a dropdown in the activity ‘Input Dialog’, if anyone have another suggestion please

image

image

Hi @dlichten,
You can just use split function here.

In the options property of input dialogue activity we can use inputtext.split(",".tochararray)Test.xaml (4.2 KB) )

You have already done it buddy
Yes we don’t need to use String.Join method and then again split it
Rather we can directly mention this expression in a assign activity like this
arr_string = configTable.AsEnumerable().Select(Function(a) a.Field(Of String)(“Name”).ToString).ToArray()

Where arr_string is a variable of type array of string

Now mention this in OPTIONS property in INPUT DIALOG BOX activity

Cheers @dlichten

the “ToCharArray” is not working in the
image

Hi @dlichten

Give it as DropDownNameList.Split(",".ToCharArray)

Thanks
Ashwin S

this is what I wrote
but the the “ToCharArray” showing an error
image

Hi @dlichten
dont give spaces within the statement

Thanks
Ashwi S

well you can do this
ArrayVar=StringVar.Split(vbNewLine.ToCharArray)
ArrayVar = ArrayVar.Where(Function(x) Not String.IsNullOrWhiteSpace(x)).ToArray
and loop through this string using for each and split based on characters

Cheers @dlichten

inputtext.split(",".tochararray)

its a dot before tochararray

1 Like

Thank you very much
I used comma instead of dot
and now it works perfectly
thank u very much

1 Like

yeah I noticed it now LOL
can u explain this method? or show a link that will?
thanks again

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