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.

A delimiter (Wikipedia) is a sequence of one or more characters used to specify the boundary between separate, independent regions in plain text or other data streams. An example of a delimiter is the comma character, which acts as a field delimiter in a sequence of comma-separated values.

See also:

3001 questions
1338
votes
14 answers

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 into my_table values('hi, my name''s tim.');
tim_wonil
  • 14,970
  • 6
  • 29
  • 42
861
votes
3 answers

C# List 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 names --> string names_together = "John, Anna, Monica"
nan
  • 19,595
  • 7
  • 48
  • 80
826
votes
7 answers

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 the fastest way to do this?
I-M-JM
  • 15,732
  • 26
  • 77
  • 103
761
votes
5 answers

Split string with multiple delimiters in Python

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 to be either a semicolon or a comma followed by a…
gt565k
  • 7,755
  • 3
  • 16
  • 9
463
votes
21 answers

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 like (in a C++ like…
Ben Combee
  • 16,831
  • 6
  • 41
  • 42
395
votes
8 answers

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://www.some-site.example/ (both because of the…
danieltahara
  • 4,743
  • 3
  • 18
  • 20
336
votes
6 answers

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 Unfortunately, cut doesn't treat several spaces as one…
mbaitoff
  • 8,831
  • 4
  • 24
  • 32
281
votes
6 answers

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 ${arr[0]} echo ${arr[1]} echo…
Nikola Novak
  • 4,091
  • 5
  • 24
  • 33
226
votes
12 answers

How to specify more spaces for the delimiter using cut?

Is there any way to specify a field delimiter for more spaces with the cut command? (like " "+) ? For example: In the following string, I like to reach value '3744', what field delimiter I should say? $ps axu | grep jboss jboss 2574 0.0 0.0 …
leslie
  • 11,858
  • 7
  • 23
  • 22
196
votes
4 answers

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, my question is now: What are delimiters and…
System.Data
  • 3,878
  • 7
  • 32
  • 40
193
votes
6 answers

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, so CVS diff dumps the entire file, even when I…
Vasu
  • 2,406
  • 3
  • 20
  • 26
130
votes
4 answers

Python split() without removing the delimiter

This code almost does what I need it to.. for line in all_lines: s = line.split('>') Except it removes all the '>' delimiters. So, Turns into ['
some1
  • 2,447
  • 8
  • 26
  • 23
130
votes
12 answers

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
AFD
  • 1,341
  • 2
  • 9
  • 8
105
votes
17 answers

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 use for this, i.e. which character is the least…
Too embarrassed to say
94
votes
2 answers

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.append(""" "{0}" { …
Dor
  • 7,344
  • 4
  • 32
  • 45
1
2 3
99 100