delimiter

Splitting a string using multiple delimiters in C

家住魔仙堡 提交于 2021-01-29 07:30:56
问题 I'm currently trying to split an array of chars that is assigned from reading in from a text file. right now I'm having troubles with delimiters and I don't know if I can have multiple. what I want to delimit is commas and spaces. Here is my code so far. #include <stdio.h> FILE * fPointer; fPointer = fopen("file name", "r"); char singleLine[1500]; char delimit[] = int i = 0; int j = 0; int k = 0; while(!feof(fPointer)){ //the i counter is for the first line in the text file which I want to

How to read when delimiter is space and missing values are blank?

夙愿已清 提交于 2021-01-24 06:54:56
问题 I have a space delimited file and some columns are blank, so we end up having multiple spaces, and fread fails with error. But read.table works fine. See example: library(data.table) # R version 3.4.2 (2017-09-28) # data.table_1.10.4-3 fread("A B C D 1 2 3 4 5 6 7", sep = " ", header = TRUE) Error in fread("A B C D\n1 2 3\n4 5 6 7") : Expected sep (' ') but new line, EOF (or other non printing character) ends field 2 when detecting types from point 0: 1 2 3 read.table(text ="A B C D 1 2 3 4 5

How to split string that delimiters remain in the end of result?

混江龙づ霸主 提交于 2021-01-04 06:41:06
问题 I have several delimiters. For example {del1, del2, del3 }. Suppose I have text : Text1 del1 text2 del2 text3 del3 I want to split string in such way: Text1 del1 text2 del2 text3 del3 I need to get array of strings, when every element of array is texti deli. How can I do this in C# ? 回答1: String.Split allows multiple split-delimeters. I don't know if that fits your question though. Example : String text = "Test;Test1:Test2#Test3"; var split = text.Split(';', ':', '#'); //split contains an

Fastest way to concatenate multiple files column wise - Python

天涯浪子 提交于 2020-12-29 12:34:53
问题 What is the fastest method to concatenate multiple files column wise (within Python)? Assume that I have two files with 1,000,000,000 lines and ~200 UTF8 characters per line. Method 1: Cheating with paste I could concatenate the two files under a linux system by using paste in shell and I could cheat using os.system , i.e.: def concat_files_cheat(file_path, file1, file2, output_path, output): file1 = os.path.join(file_path, file1) file2 = os.path.join(file_path, file2) output = os.path.join

How to build a comma delimited list from strings w/o the extra delimiter at the end? [duplicate]

左心房为你撑大大i 提交于 2020-12-23 08:00:42
问题 This question already has answers here : Printing lists with commas C++ (28 answers) Closed 3 months ago . So i'm trying to do something like this: input: hi my name is clara expected output: hi, my, name, is, clara My program looks like this: #include <iostream> #include <sstream> #include <string> using namespace std; int main() { string str; getline(cin, str); istringstream ss(str); do { string word; ss >> word; cout << word << ", "; } while (ss); } But the output looks like this hi, my,

Custom delimiter in SQL Server set in “Results to Text” options doesn't work

无人久伴 提交于 2020-12-06 11:32:10
问题 I am interested in saving the result of a SQL query, like a SELECT statement, as a pipe ( | ) delimited text file in SSMS. I can do that using the Export wizard . However, it seems there's a simpler method by setting a "Custom delimiter" in Tools>Options under Query Results>SQL Server>Results to Text as shown here: Then, if I specify "Results to Text" or "Results to File" , I am supposed to get the pipe delimited result. This is also outlined here:Obtaining Pipe Delimited Results from SQL

Move file to trimmed filename location with full name in Batch

亡梦爱人 提交于 2020-07-10 07:35:16
问题 I'm trying to move several similar files into folders based on the filename. The code below works fine but does not work if the base name is more than 5 characters, then it says the directory already exists, and moves the files to the shorter named folder. The idea is to make folders based on a text file, and move it together with pictures wich start with the same name (up to an "_" to that same folder, while the filenames remain intact. The picture names are longer though with varying

ADODB.Connection: delimiter semicolon does not work for csv text files

烈酒焚心 提交于 2020-05-28 09:48:05
问题 I use ADODB.Connection and ADODB.Recordset to get data from csv files. The problem I am facing is that the delimiter seems not to work in case of semicolon (or other than comma). I am working with a semicolon as a delimiter. This is my code: Public Function getDataFromFile(path As String, filename As String) As ADODB.Recordset Dim cN As ADODB.Connection Dim RS As ADODB.Recordset Set cN = New ADODB.Connection Set RS = New ADODB.Recordset cN.Open ("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=

Batch file : skipping folders starting with _ in FOR loop

穿精又带淫゛_ 提交于 2020-05-14 07:07:08
问题 I would like to exclude all profiles starting with _ without having to list each profile in an exclusion text file. Is it possible to do this ? @echo off set Target=D:\backup for /f "tokens=*" %%I in ('dir /a:d-h /b "%SystemDrive%\Users\*"') do if exist "%Target%\%%~nXI\" ( ........ ) pause exit Thank you very much in advance for helping ! 回答1: The following code example provides a methodology for retrieving the profile names you require, (those which are not a special account and whose names

How to import a flat file without changing regional settings on the deployment server?

烂漫一生 提交于 2020-02-15 07:40:40
问题 I am trying to read a text file in SSIS (2005/2008). I created a connection to the file and placed flat file source, and it works fine in preview but when I try to run I get error saying: [Derived Column [91848]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR So I have identified that there are couple of columns with decimal numbers which use period as delimiters. But since I work in Scandinavian environment, the servers expect comma as delimiters. What works is manually changing