text-files

How to display data from txt file in specific format

馋奶兔 提交于 2019-12-11 16:55:42
问题 I have a text file input which contains data as below. How can I display data from the text file into specific format? Monday Jessy Walking 20 minutes Matthew Run 20 minutes Karen Jogging 40 minutes Jessica Run 12 minutes Tuesday Messia Walking 10 minutes Matthew Run 20 minutes Pete Run 10 minutes Carol Walking 30 minutes I want to display data from the text file into this format: Day Name Type of exercise Time Monday Jessy Walking 20 minutes Matthew Run 20 minutes Karen Jogging 40 minutes

Display contents of Textfile data to ListView in C#

筅森魡賤 提交于 2019-12-11 16:44:24
问题 I have a listview in my form. In my text file I have this: 24-7-2017:13:44:40;x;0.0078;y;-0.0147;z;0.9879; 24-7-2017:13:44:41;x;0.0069;y;-0.0069;z;1.0104; 24-7-2017:13:44:40; represents the time where I want to put in the first column of the listview x;0.0078;y;-0.0147;z;0.9879; is where I want to create three columns to put the X,Y,Z in the each column and the data in the respective column the next line will then be in row 2 in their respective column they are separated by ";" How I go about

How to read multilines from text file in c#

家住魔仙堡 提交于 2019-12-11 16:44:08
问题 I have a text file which contains user records.In the text file one user record is present in three lines of text file.Now as per my requirement i have to read first three lines for one User, Process it and insert into database and next three lines for second user and so on.. Here is the code that i have used for single line reading from text files.. if (System.IO.File.Exists(location) == true) { using (StreamReader reader = new StreamReader(location)) { while ((line = reader.ReadLine()) !=

How can i delete last column from my text file

强颜欢笑 提交于 2019-12-11 16:41:40
问题 I would like to delete the last column from my text file. How can i achieve this. My text file is TAB delimited. Input text file looks like: Designator MAX PN Footprint Center-X(mm) Center-Y(mm) Location "C10" "100-0009" "1206 - CAPACITOR" "122.492" "69.469" "BOTTOM" "DOC1" "100-0009" "1206 - CAPACITOR" "264.211" "12.814" "BOTTOM" "C102" "100-0009" "1206 - CAPACITOR" "251.346" "11.201" "BOTTOM" "C105" "100-0009" "1206 - CAPACITOR" "0" "0" "BOTTOM" "PCB" "100-0009" "1206 - CAPACITOR" "306.197"

How do I merge 2 text files into one file?

让人想犯罪 __ 提交于 2019-12-11 15:22:23
问题 Okay so, I want to merge 2 text files : File 1 : Firstline ABCD Thirdline Fifthine File 2 : Firstline Thirdline EFGH Fifthline Expected output : Firstline ABCD Thirdline EFGH Fifthline I can't use copy filea+fileb filec with cmd because it just copy and paste one to another and merge it into one file. 回答1: Try the following procedure with notepad++: Go to file1 and add some data that cannot be found on the lines (for example @@@@@ ) at the beggining of each line with following regex replace:

Read text file into dictionary removing heading/trailing newlines

夙愿已清 提交于 2019-12-11 15:04:28
问题 This will be much easier to understand if I just show you the text file I'm working with and the code I have. Here's the text file, called employees.txt: 7 John Doe 33 272838 M Mary Johnson 38 3849383 ..... Now I have two functions. Here they are: def employee_write(file): employee_dict = {} employee_dict["First"] = file.readline() employee_dict["Last"] = file.readline() employee_dict["Experience"] = file.readline() employee_dict["ID"] = file.readline() employee_dict["Gender"] = file.readline

How to format text file with tab to make it readable and nice look

最后都变了- 提交于 2019-12-11 14:58:10
问题 I'm new to c# and currently I'm working on error logging where in error logs will be placed into a text file. My dilemma now is that, I cannot format the text file nicely, I mean to make it easily readable. Can you help me on this? Thanks in advance. See below code. Code for creating first row for headers if (!File.Exists(file)) { file = new StreamWriter(file); builder.AppendFormat("{0, 10} {1, 25} {2, 30} {3, 30} {4, 30} {5, 50} ", "LOGTYPE", "DATE", "COMPLEXITY", "MESSAGE", "EXCEPTION TYPE"

how to read text file specifications row and column in c#

怎甘沉沦 提交于 2019-12-11 14:57:59
问题 i want read the each row and column but why it will pop out error message "make sure that the maximum index on a list is less than the list size".pls help... string[] lines = File.ReadAllLines("C:\\test.txt"); for (int i = 0; i < lines.Length; i++) { string[] line = lines[i].Split('^'); for (int j = 0; j < line.Length; j++) { textBox1.Text = line[1]; break; } } 回答1: I think you wanted to have j in the line textBox1.Text = line[j]; instead of textBox1.Text = line[1]; Or it won't work if there

How to read a birthday with symbols “/” and “:” from a .txt file?

孤人 提交于 2019-12-11 14:38:47
问题 I am writing a c++ prgram and have to read some data from a .txt file.the format looks like the following: " name gender DD/MM/YYYY HH:MM:SS " I know how to read a .txt file and cin the words one by one, but i dont know how to deal with the symbols " / " or " : ". I have to compare the ages of two person. Please help! 回答1: Aside from the easiest way with sscanf , like Jerry describes, it's also possible with iostreams. Just read the data you want from the file, until you hit a seperator, and

Copy specific lines from text files into excel

牧云@^-^@ 提交于 2019-12-11 14:18:28
问题 I have developed the below code to open a large number of text files (within the same folder) and copy everything from each file into excel (one cell for each line of text file & one row for each text file). However, I do not require all of the data from the text files and it is slowing down the process. The text files are in following format: DATASET UNSTRUCTURED_GRID POINTS 5 float 0.096853 0.000000 0.111997 0.096853 -0.003500 0.111997 0.096890 0.000000 0.084015 0.096853 -0.003500 0.111997