Header Split

I want to Split Text file header then how i do it

Hi @Yogita_Gaikwad

Can you share the Sample Input and expected output

Hello @Yogita_Gaikwad ,

Please check this megapost:

Hope it helps!
Best regards,
Marius


This is my code


Text file header come like this i want split like

InvoiceNumber
BillingDate
ShipDateSalesOfficeNumber
.
.
.

Can you share the Text file here @Yogita_Gaikwad

sorry i can’t share

Share this only @Yogita_Gaikwad

@Yogita_Gaikwad In that text file, do you have only headers? If you have only headers, I could see space in between each header you can use “String.Split(” “C)” and have the values as a array

sam.txt (345 Bytes)

Hi @Yogita_Gaikwad

How about this expression

yourString.Split(Environment.NewLine.ToCharArray).AsEnumerable().Where(Function(x) Not String.IsNullOrEmpty(x.ToString.Trim)).ToArray()

Or

yourString.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries)

image

Regards
Gokul

sam.txt (343 Bytes)
this is my text file can u split this like
InvoiceNumber
BillingDate
ShipDate
.
.

hi @Yogita_Gaikwad,

You can create a List(Of String) type variable and then initialize it. Then after that you can split the string by using “yourString.Split(vbTab.ToCharArray).ToList”

I also attached my code here for your reference
StringSplit.zip (2.4 KB)

If this does helped you, kindly mark it as Solved to help others as well. Thanks.

Kind regards,
Kenneth

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