Questions tagged [delimiter]
A delimiter is a sequence of one or more characters used to specify the boundary between separate, independent regions in plain text or other data streams.
3,028
questions
1378
votes
15
answers
1.8m
views
How do I escape a single quote in SQL Server?
I am trying to insert some text data into a table in SQL Server 9.
The text includes a single quote '.
How do I escape that?
I tried using two single quotes, but it threw me some errors.
eg. insert ...
891
votes
3
answers
997k
views
C# List<string> to string with delimiter
Is there a function in C# to quickly convert some collection to string and separate values with delimiter?
For example:
List<string> names --> string names_together = "John, Anna, Monica"
831
votes
7
answers
1.2m
views
Remove trailing delimiting character from a delimited string
What is fastest way to remove the last character from a string?
I have a string like
a,b,c,d,e,
I would like to remove the last ',' and get the remaining string back:
OUTPUT: a,b,c,d,e
What is ...
788
votes
5
answers
1.5m
views
Split string with multiple delimiters in Python [duplicate]
I found some answers online, but I have no experience with regular expressions, which I believe is what is needed here.
I have a string that needs to be split by either a ';' or ', '
That is, it has ...
481
votes
21
answers
182k
views
Can you use a trailing comma in a JSON object?
When manually generating a JSON object or array, it's often easier to leave a trailing comma on the last item in the object or array. For example, code to output from an array of strings might look ...
405
votes
8
answers
436k
views
How to escape indicator characters (colon and hyphen) in YAML
In a config file, I have a key to which I wish to assign a URL. The problem is that YAML interprets : and - characters as either creating mappings or lists, so it has a problem with the line
url: http:...
338
votes
6
answers
171k
views
How to make the 'cut' command treat same sequental delimiters as one?
I'm trying to extract a certain (the fourth) field from the column-based, 'space'-adjusted text stream. I'm trying to use the cut command in the following manner:
cat text.txt | cut -d " " -f 4
...
292
votes
6
answers
361k
views
How to read a space-delimited string into an array in Bash?
I have a variable which contains a space-delimited string:
line="1 1.50 string"
I want to split that string with space as a delimiter and store the result in an array, so that the following:
echo ${...
227
votes
13
answers
169k
views
How to specify more spaces for the delimiter using cut?
Is there a way to specify multiple spaces as a field delimiter with the cut command (something like a " "+ regex)? For example, what field delimiter I should specify for the following ...
200
votes
5
answers
226k
views
Delimiters in MySQL
I often see people are using Delimiters. I tried myself to find out what are delimiters and what is their purpose. After 20 minutes of googling, I was not able to find an answer which satisfies me. So,...
193
votes
6
answers
150k
views
Eclipse and Windows newlines
I had to move my Eclipse workspace from Linux to Windows when my desktop crashed. A week later I copy it back to Linux, code happily, commit to CVS. And alas, windows newlines have polluted many files,...
134
votes
12
answers
298k
views
SQL split values to multiple rows
I have table :
id | name
1 | a,b,c
2 | b
i want output like this :
id | name
1 | a
1 | b
1 | c
2 | b
133
votes
4
answers
181k
views
Python split() without removing the delimiter [duplicate]
This code almost does what I need it to..
for line in all_lines:
s = line.split('>')
Except it removes all the '>' delimiters.
So,
<html><head>
Turns into
['<html','<...
112
votes
17
answers
85k
views
Least used delimiter character in normal text < ASCII 128
For coding reasons which would horrify you (I'm too embarrassed to say), I need to store a number of text items in a single string.
I will delimit them using a character.
Which character is best to ...
96
votes
2
answers
61k
views
str.format() raises KeyError
The following code raises a KeyError exception:
addr_list_formatted = []
addr_list_idx = 0
for addr in addr_list: # addr_list is a list
addr_list_idx = addr_list_idx + 1
addr_list_formatted....
93
votes
21
answers
328k
views
Split a string into an array of strings based on a delimiter
I'm trying to find a Delphi function that will split an input string into an array of strings based on a delimiter. I've found a lot from searching the web, but all seem to have their own issues and I ...
92
votes
3
answers
185k
views
Split comma separated column data into additional columns
I have comma separated data in a column:
Column
-------
a,b,c,d
I want to split the comma separated data into multiple columns to get this output:
Column1 Column2 Column3 Column4
------- -----...
92
votes
5
answers
185k
views
Convert commas decimal separators to dots within a Dataframe
I am importing a CSV file like the one below, using pandas.read_csv:
df = pd.read_csv(Input, delimiter=";")
Example of CSV file:
10;01.02.2015 16:58;01.02.2015 16:58;-0.59;0.1;-4.39;NotApplicable;0....
82
votes
13
answers
61k
views
Capturing output of find . -print0 into a bash array
Using find . -print0 seems to be the only safe way of obtaining a list of files in bash due to the possibility of filenames containing spaces, newlines, quotation marks etc.
However, I'm having a ...
81
votes
12
answers
121k
views
What's the best separator/delimiter character(s) for a plaintext db file? [closed]
What's the best separator/delimiter character(s) for a plaintext db file?
I considered using |, ,, <TAB>, ;, etc. But they all seem to be possible to break when the nearby entries have special ...
76
votes
10
answers
79k
views
JS string.split() without removing the delimiters [duplicate]
How can I split a string without removing the delimiters?
Let's say I have a string:
var string = "abcdeabcde";
When I do
var newstring = string.split("d"), I get something like this:
["abc","eabc",...
75
votes
5
answers
38k
views
Reading null delimited strings through a Bash loop
I want to iterate through a list of files without caring about what characters the filenames might contain, so I use a list delimited by null characters. The code will explain things better.
# Set ...
67
votes
3
answers
331k
views
How do I use a delimiter with Scanner.useDelimiter in Java?
sc = new Scanner(new File(dataFile));
sc.useDelimiter(",|\r\n");
I don't understand how delimiter works, can someone explain this in layman terms?
65
votes
1
answer
21k
views
Angular JS custom delimiter
How do I use a custom delimiter for angular JS? I'd like to change from the {{ var }} syntax to [[ var ]].
Can somebody show me a complete example on how to implement this with Angular?
62
votes
6
answers
93k
views
Delphi: StringList Delimiter is always a space character even if Delimiter is set
I am having trouble with the delimiter in the TStringList Class. Take a look:
var
s: string;
sl: TStringList;
begin
sl := TStringList.Create;
s := 'Users^foo bar^bar foo^foobar^barfoo';
sl....
62
votes
1
answer
61k
views
What does the random string after a WebKitFormBoundary do \ mean?
I'm trying to use a BI tool to automate a process which extracts data from our DB system, and then upload it to a web site via HTTP POST.
The BI Tool I'm using allows me to build the Request up as a ...
56
votes
5
answers
91k
views
Convert a delimted string to a dictionary<string,string> in C#
I have a string of the format
"key1=value1;key2=value2;key3=value3;"
I need to convert it to a dictionary for the above mentioned key value pairs.
What would be the best way to go about this?
Thanks....
56
votes
2
answers
16k
views
Is it possible to use AngularJS with the Jinja2 template engine?
I have a Flask site and I want to use the AngularJS JavaScript framework. Unfortunately, it seems as if the delimiters overlap.
How do I use Angular with Jinja2 if both rely on double curly braces ...
55
votes
6
answers
71k
views
Can I import a CSV file and automatically infer the delimiter?
I want to import two kinds of CSV files, some use ";" for delimiter and others use ",". So far I have been switching between the next two lines:
reader=csv.reader(f,delimiter=';')
or
reader=csv....
53
votes
6
answers
70k
views
How can I split by 1 or more occurrences of a delimiter in Python?
I have a formatted string from a log file, which looks like:
>>> a="test result"
That is, the test and the result are split by some spaces - it was probably ...
53
votes
4
answers
55k
views
changing the delimiter for cin (c++)
I've redirected "cin" to read from a file stream cin.rdbug(inF.rdbug())
When I use the extraction operator it reads until it reaches a white space character.
Is it possible to use another delimiter? ...
52
votes
6
answers
120k
views
Hive load CSV with commas in quoted fields
I am trying to load a CSV file into a Hive table like so:
CREATE TABLE mytable
(
num1 INT,
text1 STRING,
num2 INT,
text2 STRING
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ",";
LOAD DATA LOCAL ...
50
votes
3
answers
16k
views
Include )" in raw string literal without terminating said literal
The two characters )" terminate the raw string literal in the example below.
The sequence )" could appear in my text at some point, and I want the string to continue even if this sequence is found ...
50
votes
2
answers
74k
views
How to use cut with multiple character delimiter in Unix?
My file looks like this
abc ||| xyz ||| foo bar
hello world ||| spam ham jam ||| blah blah
I want to extract a specific column, e.g. I could have done:
sed 's/\s|||\s/\\t/g' file | cut -f1
But is ...
49
votes
2
answers
358k
views
Split String by delimiter position using oracle SQL
I have a string and I would like to split that string by delimiter at a certain position.
For example, my String is F/P/O and the result I am looking for is:
Therefore, I would like to separate the ...
48
votes
0
answers
32k
views
What delimiters can you use in sed? [duplicate]
We normally see people complaining about the unknown option to s' error in sed when they want to use a pattern that contains the sed delimiter.
For example, if we are using /:
$ var="hel/lo"
$ sed "...
46
votes
10
answers
234k
views
String delimiter in string.split method
I have following data:
1||1||Abdul-Jabbar||Karim||1996||1974
I want to delimit the tokens.
Here the delimiter is "||".
My delimiter setter is:
public void setDelimiter(String delimiter) {
...
45
votes
6
answers
90k
views
What does DELIMITER // do in a Trigger?
DELIMITER //
What is the of use of it?
42
votes
7
answers
80k
views
Split a string into words by multiple delimiters [duplicate]
I have some text (meaningful text or arithmetical expression) and I want to split it into words.
If I had a single delimiter, I'd use:
std::stringstream stringStream(inputString);
std::string word;
...
41
votes
10
answers
35k
views
When to use the terms "delimiter," "terminator," and "separator"
What are the semantics behind usage of the words "delimiter," "terminator," and "separator"? For example, I believe that a terminator would occur after each token and a separator between each token. ...
41
votes
3
answers
226k
views
How to use delimiter for CSV in Python?
I'm having trouble with figuring out how to use the delimiter for csv.writer in Python.
I have a CSV file in which the strings separated by commas are in single cell and I need to have each word in ...
39
votes
2
answers
33k
views
Escaping colons in YAML
Does anyone know how to escape colons in YAML? The key in my yml is the
domain with port number, but the yml file isn't working with this setup:
###BEGIN
production:
### THIS IS THE ONE I'm HAVING ...
39
votes
3
answers
30k
views
Escaping separator within double quotes, in awk
I am using awk to parse my data with "," as separator as the input is a csv file. However, there are "," within the data which is escaped by double quotes ("...").
Example
filed1,filed2,field3,"...
34
votes
10
answers
257k
views
Split function in oracle to comma separated values with automatic sequence
Need Split function which will take two parameters, string to split and delimiter to split the string and return a table with columns Id and Data.And how to call Split function which will return a ...
33
votes
5
answers
86k
views
Convert Comma Separated column value to rows
I have a table Sample with data stored like below
Id
String
1
abc,def,ghi
2
jkl,mno,pqr
I need the output like..
Id
processedrows
1
abc
1
def
1
ghi
2
jkl
2
mno
2
pqr
How can I do the same ...
31
votes
3
answers
47k
views
Backslash zero delimiter '\0'
I have seen '\0' to be used as a delimiter in mixed binary files (UTF8 strings + binary data). Could anyone explain what '\0' means or point to a good place to study?
30
votes
1
answer
16k
views
Echo changes my tabs to spaces
I'm taking the following structure from around the net as a basic example of how to read from a file in BASH:
cat inputfile.txt | while read line; do echo $line; done
My inputfile.txt is tab-...
30
votes
4
answers
51k
views
Can I use 2 or more delimiters in C++ function getline? [duplicate]
I would like to know how can I use 2 or more delimiters in the getline functon, that's my problem:
The program reads a text file... each line is goning to be like:
New Your, Paris, 100
CityA, ...
28
votes
8
answers
47k
views
Delimiter to use within a query string value
I need to accept a list of file names in a query string. ie:
http://someSite/someApp/myUtil.ashx?files=file1.txt|file2.bmp|file3.doc
Do you have any recommendations on what delimiter to use?
27
votes
3
answers
71k
views
How do I explode an integer
the answer to this could be easy. But I'm very fresh to programming. So be gentle...
I'm at work trying to do a quick fix for one of your customers. I want to get the total numbers of digits in a ...