delimiter

Splitting up data file in Java Scanner

我们两清 提交于 2019-12-02 00:55:30
I have the following data which I want to split up. (1,167,2,'LT2A',45,'Weekly','1,2,3,4,5,6,7,8,9,10,11,12,13'), to obtain each of the values: 1 167 2 'LT2A' 45 'Weekly' '1,2,3,4,5,6,7,8,9,10,11,12,13' I am using the Scanner class to do that and with , as the delimiter. But I face problems due to the last string: ('1,2,3,4,5,6,7,8,9,10,11,12,13') . I would hence like some suggestions on how I could split this data. I have also tried using ,' as the delimiter but the string contains data without ''. The question is quite specific to my needs but I would appreciate if someone could give me

Javascript and RegEx: Split and keep delimiter

↘锁芯ラ 提交于 2019-12-02 00:31:02
I have a regex which will split my string into arrays. Everyything works fine except that I would like to keep a part of the delimiter. Here is my regex: (&#?[a-zA-Z0-9]+;)[\s] in Javascript, I am doing: var test = paragraph.split(/(&#?[a-zA-Z0-9]+;)[\s]/g); My paragraph is as followed: Current addresses: † Biopharmaceutical Research and Development<br /> ‡ Clovis Oncology<br /> § Pisces Molecular <br /> || School of Biological Sciences ¶ Department of Chemistry<br /> The problem is that I am getting 10 elements in my array and not 5 as I should. In fact, I am also getting my delimiter as an

explode() on Japanese string

丶灬走出姿态 提交于 2019-12-01 22:21:06
问题 I have to use the explode() function on Japanese text but it doesn't work. Here is an example of what I have $string = '私 は イタリア 人 です'; $string = explode(" ", $string); print_r($string); That prints Array ( [0] => 私 は イタリア 人 です ) in place of Array ( [0] => 私 [1] => は [2] => イタリア [3] => 人 [4] => です ) It seems that explode() can't recognize the spaces inside that text. What's the reason? How could I make it work? 回答1: That is for the simple reason that you do not have a space character here.

split char string with multi-character delimiter in C

孤者浪人 提交于 2019-12-01 21:44:57
问题 I want to split a char *string based on multiple-character delimiter. I know that strtok() is used to split a string but it works with single character delimiter. I want to split char *string based on a substring such as "abc" or any other sub-string. How that can be achieved? 回答1: Finding the point at which the desired sequence occurs is pretty easy: strstr supports that: char str[] = "this is abc a big abc input string abc to split up"; char *pos = strstr(str, "abc"); So, at that point, pos

explode() on Japanese string

女生的网名这么多〃 提交于 2019-12-01 21:38:42
I have to use the explode() function on Japanese text but it doesn't work. Here is an example of what I have $string = '私 は イタリア 人 です'; $string = explode(" ", $string); print_r($string); That prints Array ( [0] => 私 は イタリア 人 です ) in place of Array ( [0] => 私 [1] => は [2] => イタリア [3] => 人 [4] => です ) It seems that explode() can't recognize the spaces inside that text. What's the reason? How could I make it work? That is for the simple reason that you do not have a space character here. You have an "IDEOGRAPHIC SPACE" character with the hex code "e3 80 80". If you use that as your delimiter, it

strtok() analogue in C++

只谈情不闲聊 提交于 2019-12-01 20:59:37
I just can't find an algorithm to split the string into words by numerous delimiters. I know how to split a string by whitespace with istringtream and by single delimiter with getline . How can I connect them all. For instance: input : This -is-a!,string; output : This is a string #include <iostream> #include <string> #include <vector> using namespace std; void SplitToVector(vector<string> &v, string dlm, string src){ string::size_type p, start=0, len=src.length(); v.clear(); start = src.find_first_not_of(dlm); p = src.find_first_of(dlm, start); while(p != string::npos){ v.push_back(src.substr

Split delimited entries into new rows in Access

杀马特。学长 韩版系。学妹 提交于 2019-12-01 20:57:51
So someone gave me a spreadsheet of orders, the unique value of each order is the PO, the person that gave me the spreadsheet is lazy and decided for orders with multiple PO's but the same information they'd just separate them by a "/". So for instance my table looks like this PO Vendor State 123456/234567 Bob KY 345678 Joe GA 123432/123456 Sue CA 234234 Mike CA What I hoped to do as separate the PO using the "/" symbol as a delimiter so it looks like this. PO Vendor State 123456 Bob KY 234567 Bob KY 345678 Joe GA 123432 Sue CA 123456 Sue CA 234234 Mike CA Now I have been brainstorming a few

Parsing with multiple delimiters, in C

喜欢而已 提交于 2019-12-01 20:56:06
问题 In C, what is the best way to parse a string with multiple delimiters? Say I have a string A,B,C*D and want to store these values of A B C D. I'm not sure how to deal with the * elegantly, other than to store the last string C*D and then parse that separately with a * delimiter. If it was just A,B,C,*D I'd use strtok() and ignore the first index of the *D to get just D, but there is no comma before the * so I don't know that * is coming. 回答1: You can use multiple delimiters with strtok , the

Java - Scanning comma delimited double and int values

十年热恋 提交于 2019-12-01 20:51:37
I'm trying to use Java's Scanner class to scan in double and int values delimited by commas. The following Scanner input = new Scanner(System.in).useDelimiter("\\D"); can only scan int values separated by , . e.g. input = 1000,2,3 How do I scan in double and int values separated by , e.g. input = 1000.00,3.25,5 or 100.00,2,3.5 ? I tried the following but they don't seem to work: Scanner input = new Scanner(System.in).useDelimiter(","); Scanner input = new Scanner(System.in).useDelimiter("\\,"); Scanner input = new Scanner(System.in).useDelimiter("[,]"); Using these seems to hang the code.

Python escape delimiter in configuration file using ConfigParser

可紊 提交于 2019-12-01 19:50:11
I'd like to escape ":" and/or "=" as the name in a configuration file. Does anyone know how to achieve this? I try backslash "\", it does not work. skrrgwasme If you're using Python 3, you don't need to. Look at the Python docs section on Customizing Parser Behavior . By default, configparser uses ":" and "=" as delimiters, but you can specify different delimiters when you create the configparser object: import configparser parser = configparser.ConfigParser(delimiters=('?', '*')) In this example, the default delimiters have been replaced with a question mark and an asterisk. You can change