Hi,
I have Excel and I am reading the entire data into the data table. I need to convert the entire data table into lower or upper case. How can I achieve that?
Hi,
I have Excel and I am reading the entire data into the data table. I need to convert the entire data table into lower or upper case. How can I achieve that?
similar to
we can do
(From r In dtData.AsEnumerable
let ra = r.ItemArray.Select(Function (x) x.ToString.Trim.ToUpper()).toArray()
Select dtCorrected.Rows.Add(ra)).CopyToDataTable()
UPD1
[HowTo] LINQ (VB.Net) Learning Catalogue - Help / Something Else - UiPath Community Forum
Hi @Krithi1
If you want the entire datatable in Uppercase use the below linq query:
(From row In dt.AsEnumerable()
Let r = row.ItemArray.Select(Function(field) field.ToString().ToUpper()).ToArray()
Select dt.Clone().Rows.Add(r)).CopyToDataTable()
Output DataType is System.Data.DataTable
If you want the entire datatable in Lowercase use the below linq query:
(From row In dt.AsEnumerable()
Let r = row.ItemArray.Select(Function(field) field.ToString().ToLower()).ToArray()
Select dt.Clone().Rows.Add(r)).CopyToDataTable()
Output DataType is System.Data.DataTable
Regards
Hey @Krithi1
You can use this expression for uppercases:
dt.AsEnumerable().Select(Function(row) dt.Clone().LoadDataRow(row.ItemArray.Select(Function(field) field.ToString().ToUpper()).ToArray(), False)).CopyToDataTable()
Hi @Krithi1
Use below expression to convert the entire DT into Upper or Lower Case.
For Upper Case
(From row In DT.AsEnumerable()Select row.ItemArray.Select(Function(c) c.ToString().ToUpper()).ToArray()).CopyToDataTable()
For Lower Case
(From row In DT.AsEnumerable()Select row.ItemArray.Select(Function(c) c.ToString().ToLower()).ToArray()).CopyToDataTable()
Hope it will helps you
Cheers!!
Thank you, everyone, seems like every solution provided above will work in my case.
Is there any specific training on LinQ that I could take? or are there any documents regarding LinQ?
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.