Substring from text file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vinsbg
    New Member
    • Jan 2012
    • 4

    Substring from text file

    Hi,
    Can someone help me how to substring first 8 digits from number?
    I have text file with around 10k lines. Each line contains number with length 12-14 digits. I want to take only first 8 digits from each number and writ it in new file.

    Since I'm quite new in programing I have no idea from where to start.

    Thank you
  • vinsbg
    New Member
    • Jan 2012
    • 4

    #2
    Ok, I found a solution to this. Please delete this post.

    I will do it like this:

    Code:
     sw.WriteLine(line.Substring(0, Math.Min(line.Length, 8)));
    Thank you!

    Comment

    Working...