Convert system string on string

how to convert system string on string

image

you had defined a variable of datatype String( ) - a string Array
In this case the default value would be {"testgmail.com"}

its just for the exemple but i have an argument with this kind of string i need to syntaxe to convert it

HI @Soudios

Default value of String[array] will always be like this String inside the curly braces (i.e., {“Sample@gmail.com”} )

if you want to get a value from the System.String[array] to String, You can get that from index of the values

For example
Lets say we have ArrMail variable which is String[array] datatype
If you want the value as string you should do like
ArrMail(0).ToString it will print your 1st value in the array

Method 2:
image

  • Drag a For each activity and pass the ArrMail in the value field
    • Now if you print item.ToString you will get all the mail Id while looping

Hope this Helps

Regards
Sudharsan

1 Like

Hi @Soudios ,

Are you trying to convert an Array of Strings to a single block of string?
That can be achieved using the Join Method like so:
image

String.Join(",",arr_variable) ->If you want a delimiter
String.Join(String.Empty,arr_variable) -> If you don't want any gaps

Kind Regards,
Ashwin A.K

1 Like

HI @Soudios

You can achieved using Join method as @ashwin.ashok Suggested

Try this expression

String.Join(",",DtMaster.AsEnumerable.Select(Function(r) r(ColumnNameorIndex).ToString)).ToList

ColumnNameorIndex → Column Name from DataTable

Regards
Gokul

Fine

If you have a string argument and want to convert that to a array variable then

{argumentname.ToString}

Or you can use ADD TO COLLECTIONS activity where in

Item property - argument name
Collection property - listinput

Where listinput is a variable of type System.Collections.Generic.List(of String) defined in variable panel with default value as New List(of String)

Then you can convert this list to array easily like this

Listinput.ToArray()

As simple as that

Cheers @Soudios

i have an excel with many email and i need to send with the activity ''send mail 365 microsoft"

for that i am using “for each row”

the email inside the excel file are on string but when i want to put the email on the activity send mail it ask me to put it string array.

i need to the right sentence to concert the email string on array string

what i need to write on the assign plz ?

Perfect then

Let’s take you have a excel with one column having email ids

Then get that data from excel as a DATATABLE named dt

  1. First use a assign activity like this

strmailid = String.Empty

  1. Use a for each row activity and pass dt as input

  2. Inside the loop use a assign activity like this

strmailid = CurrentRow(“mailid columnname”).ToString.Trim + “;” +Strmailid

This will create a mail is list with semicolon as a separator

Cheers @Soudios

ok but i have only one email per row don’t need “;” i think

Yeah but when you are mention as a list in outlook or any mail service provider we need to mention them all together with a semicolon in between
Isn’t it

Or if you just want the list of all mai ids as a string you can ignore that separator

Cheers @Soudios

Hi @Soudios ,

You have one mail per row, meaning only one To Recipient, if that’s the case, you can just mention the Email ID value in {}

{"Your Email ID"} in the To Property of the Activity.

Let us know if this doesn’t help

how can i do that ?