Filter row by the character is starts with

I would like to filter rows by the start character to be ‘A’.
e.g.
Apple
Banana
Accrison

I would only want the apple and accrison as the output… How may I go about doing so?

Thank you xoxo

@sangasangasanga Use below statement. You will get result as dataTable based on ur variable.

UrDataTableVariable.Select(“[UrcolumnName] Like’A%'”).CopyToDataTable

@Manjuts90
Hi is there any other way. I would like filter first then add to dt

@sangasangasanga In for each row of datatable, Get value from required column, using if condition check first letter has required alphabet, If condition is true add row to new datatable otherwise loop go to next and process repeat.

@Manjuts90
Seems workable. But i need your help, this code doesn’t work for the if condition
row.Select(“Like ‘G’%”)

@sangasangasanga In if condition dont use below condition

row.Select(“Like ‘G’%”)

@Manjuts90 hmm what condition can i use?

@sangasangasanga

Below condition is simple than other method Bro

UrDataTableVariable.Select(“[UrcolumnName] Like’A%’”).CopyToDataTable

1 Like

Hi,
There are another option available, you can use a IF condition and put there
yourstring.tostring.startwith(“A”)

Thanks & Regards
Bagish Ojha

2 Likes