Hi.
I have the following string: 17 45 65 2 7 8 4
a. how do I make it a DataTable?
b. how do I remove even numbers?
c. how I order the numbers from least to greatest and again I transform them into a string?
Thank you so much.
I hope you’re well.
Here are the steps I’d follow:
- Build datatable
- Assign activity to split the string into an array (splitting by spaces)
- If statement compare number (convert string to int) to mod 2 = 0. This tests for even numbers.
- Add Data Row activity
- In the property window you can find ArrayRow, add your array in that field
- Sort data table
Hope that helps.
Hi,
Hope the following helps you.
a. how do I make it a DataTable?
Can you try Generate Datatable activity with the following settings
CSV Parse : true
Column Separator : " "
b. how do I remove even numbers?
Let’s say str="17 45 65 2 7 8 4"
strRemoveEven = String.Join(" ",str.Split({" "c}).Where(function(x) Cint(x) mod 2 =1))
c. how I order the numbers from least to greatest and again I transform them into a string?
strOrdered = String.Join(" ",str.Split({" "c}).OrderBy(function(x) Cint(x)))
Regards,
1 Like