Remove first line of string?

let say I have the string below:

PartNumber Quantity
MGN63TH/A,1500
MGN93TH/A,300
MGND3TH/A,200

My goal is to remove the PartNumber and Quantity Headers

is there a simple way to do it?

thanks

How about this? YourStringVariable.Replace("PartNumber Quantity", "")

Or, assuming your data consists of header text followed by lines of data, a more generic solution can be done by splitting the text by a newline character and joining them together, skipping the first line which contains the header. This is a more generic approach that doesn’t depend on what text the header is, it just assumes the first line is the header and removes it each time.

String.Join(vbCrLf, Strings.Split(MyText, vbCrLf).Skip(1))

image

Hi,

Another approach:

Can you try the following expression?

System.Text.RegularExpressions.Regex.Replace(yourString,"^.*\n","")

Regards,

Hi @alvin.c.apostol26

How about this expression?

System.Text.RegularExpressions.Regex.Replace(YourString,"\D+\n","").Tostring

Regards
Gokul

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