delimiter

Best way to split a string into tokens skipping escaped delimiters?

I'm receiving an NSString which uses commas as delimiters, and a backslash as an escape character. I was looking into splitting the string using componentsSeparatedByString, but I found no way to specify the escape character. Is there a built-in way to do this? NSScanner? CFStringTokenizer? If not, would it be better to split the string...

Ruby file IO delimiters?

I am trying to parse a text file that contains a variable number of words and numbers per line, like this: foo 4.500 bar 3.00 1.3 3 foo bar How can I read the file delimited by spaces instead of newlines? Is there some way I can set the File("file.txt").foreach method to use a spaces instead of newlines as a delimiter? ...

Correct termiology for documentation

The documentation below is for a module, which has now been "decommissioned" and I'm writing it's replacement. Before i write the replacement I want to get my terms right. I know the terms are wrong in the documentation - it was hacked together quickly so i could instruct a college working on the hardware side of this project on how to u...

Java: use scanner delimiter as token

Hi, I'm trying to find a good way to get a Scanner to use a given delimiter as a token. For example, I'd like to split up a piece of text into digit and non-digit chunks, so ideally I'd just set the delimiter to \D and set some flag like useDelimiterAsToken, but after briefly looking through the API I'm not coming up with anything. Right...

Regular Expression to Match " | "

Hey guys, I am trying to use Java's useDelimiter method on it's Scanner class to do some simple parsing. Basically each line is a record delimited by " | ", so for example: 2 | John Doe 3 | Jane Doe 4 | Jackie Chan The method takes as a parameter a regular expression for which to match for. Can someone please provide me with the regul...

How to extract fields from a text line that has no constant deliminator?

What is the best way to extract each field from each line where there is no clear separator (deliminator) between each field? Here is a sample of the lines I need to extract its fields: 3/3/2010 11:00:46 AM BASEMENT-IN 3/3/2010 11:04:04 AM 2, YaserAlNaqeb BASEMENT-OUT 3/3/2010 11:04:06 AM ...

Can you use zero-width matching regex in String split?

System.out.println( Arrays.deepToString( "abc<def>ghi".split("(?:<)|(?:>)") ) ); This prints [abc, def, ghi], as if I had split on "<|>". I want it to print [abc, <def>, ghi]. Is there a way to work some regex magic to accomplish what I want here? Perhaps a simpler example: System.out.println( Arrays.deepToStrin...

Python: Split by 1 or more occurrences of a delimiter

Hi, 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 created using formatted string which gave test some constant spacing. Simple splitting won't do the trick: >>> a.split(" ") ['test', '', '', '', ...

PHP - fgetcsv - Delimiter being ignored?

I'm trying to output each line in a csv file, and it seems like the delimiter is being ignored... I'm sure my syntax is wrong somewhere, but can't seem to pinpoint it... The CSV file looks like this: ID,Code,Count TM768889,02001,10 TM768889,02002,10 TM768889,02003,10 TM768889,02004,10 TM768889,02005,10 I'm trying to output: 0 ...

Delphi - How do I split a string into an array of strings based on a delimiter?

Hello all, 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 on Google, but all seem to have their own issues and I haven't been able to get any of them to work. I just need to split a string like: "word:doc,txt,docx" into an array based on ':'. The res...

Replacing delimiter characters in file path

I'm developing a C# web application in VS 2008. I let the user select an input file and then I store the file path in a string variable. However, it stores this path as "C:\\folder\\...". So my question is how do I convert this file path into single "\"? Thank you guys for all your helps! Please forgive me as I am a newbie to ASP....

Reading CSV files in numpy where delimiter is ","

Hello all, I've got a CSV file with a format that looks like this: "FieldName1", "FieldName2", "FieldName3", "FieldName4" "04/13/2010 14:45:07.008", "7.59484916392", "10", "6.552373" "04/13/2010 14:45:22.010", "6.55478493312", "9", "3.5378543" ... Note that there are double quote characters at the start and end of each line ...

Is it safe to use random Unicode for complex delimiter sequences in strings?

Question: In terms of program stability and ensuring that the system will actually operate, how safe is it to use chars like ¦, § or ‡ for complex delimiter sequences in strings? Can I reliable believe that I won't run into any issues in a program reading these incorrectly? I am working in a system, using C# code, in which I have to s...

How to parse out html links from a huge string with html links and other text (Java).

Hello, my question is how would i be able to go through a string and take out only the links and erase all the rest? I thought about using some type of delimiter, but wouldn't know how to go about using it in Java. an example of what i am trying to do: this is my String: String myString = "The file is http: // www. .com/hello.txt a...

Why the field separator character must be only one byte?

data <- read.delim("C:\\test.txt", header = FALSE, sep = "$$$$$") Error in scan(file, what = "", sep = sep, quote = quote, nlines = 1, quiet = TRUE, : invalid 'sep' value: must be one byte Why there is a restriction like this? Can I overcome it? ...

Parse both symbols . and , as decimal digits delimiter in ASP.NET

I'm writing a banking system and my customer wants support both Russian and American numeric standards in decimal digits delimiter. Respectively . and ,. Now only , works properly. Perhaps because of web server's OS format (Russian is set). String like 2000.00 throws a FormatException: Input string was not in a correct format. H...

How to programmatically guess whether a CSV file is comma or semicolon delimited

In most cases, CSV files are text files with records delimited by commas. However, sometimes these files will come semicolon delimited. (Excel will use semicolon delimiters when saving CSVs if the regional settings has the decimal separator set as the comma -- this is common in Europe. Ref: http://en.wikipedia.org/wiki/Comma-separate...

Separating arguments to a function, in locales with comma as decimal marker

In locales, e.g. French, with comma as decimal indicator (where "5,2" means five and two-tenths), how do users separate function arguments from each other? For example, in many programming/scripting languages, I could specify MAX(1.5, X) in a EN-US locale. How do you avoid the ambiguity between the comma as decimal indicator, and as ...

OCaml delimiters and scopes

Hello! I'm learning OCaml and although I have years of experience with imperative programming languages (C, C++, Java) I'm getting some problems with delimiters between declarations or expressions in OCaml syntax. Basically I understood that I have to use ; to concatenate expressions and the value returned by the sequence will be the ...

How to skip extra lines before the header of a tab delimited delimited file in R

The software I am using produces log files with a variable number of lines of summary information followed by lots of tab delimited data. I am trying to write a function that will read the data from these log files into a data frame ignoring the summary information. The summary information never contains a tab, so the following function ...