473,398 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Substring from text file

4
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
Oct 15 '13 #1

✓ answered by vinsbg

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

I will do it like this:

Expand|Select|Wrap|Line Numbers
  1.  sw.WriteLine(line.Substring(0, Math.Min(line.Length, 8)));
Thank you!

1 2066
vinsbg
4
Ok, I found a solution to this. Please delete this post.

I will do it like this:

Expand|Select|Wrap|Line Numbers
  1.  sw.WriteLine(line.Substring(0, Math.Min(line.Length, 8)));
Thank you!
Oct 15 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Rizwan | last post by:
I have the following tasks : 1) receive a flat text file which contains data and 2) convert it into an XML The flat text file for example is in this format : 1 2...
3
by: JSM | last post by:
Hi, I am just trying to port an existing simple encryption routine to C#. this routine simply adds/substracts 10 ascii characters to each character in a text file (except quotes). The routine...
31
by: microsoft.news.com | last post by:
I need to read a text file but I need to start on line 2 of the file, How can I start reading the text file starting with the second line and not the first line in the file?
1
by: r1100r98 | last post by:
I am having a problem moving the data from a datatable to the SQL2005 table (using VB2005). See code below. The SQL2005 table is empty, the datatable is being filled from a text file, not from...
15
by: d4 | last post by:
I have a vbscript (below) I want to rewrite in C# but I cannot get it to work (unless there is a better way to do it). The script will combine 2 lines if the (next) line contains a "+",...
1
by: CAM123 | last post by:
I have added: <br><xsl:value-of select="Line" /></br> to my XSLT stylesheet to get a line per repeating block. When I view the output as XML it looks perfect - one line per block. However...
5
by: Walter Thizo | last post by:
Hi Programmers Look at the text files below - ................................................................................................................ 18-JUL-2008 11:10 ...
5
by: Chocolade | last post by:
All the solutions here are great. But for now im keeping on my own code cuz i want also to learn the way i started to do it. So what i did so far is: private void inloop() {
2
by: finked1973 | last post by:
Hi All I have a piece of code in my application that is giving me a funny result. I am reading a text file and based on it's first word on the line I have a bunch of IF statements that then assign...
1
by: chibbie23 | last post by:
I have been working with one of my projects in asp.net. The user is to upload a text file. I read the file line by line, I first store the line in a string, and since the data is in a fix position, i...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.