delimiter

Split a string into an array of strings based on a delimiter

故事扮演 提交于 2019-11-26 12:16:14
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 result would be ['word', 'doc,txt,docx'] . Does anyone have a function that they know works? Thank you RRUZ you can use the TStrings.DelimitedText property for split an string check this sample program Project28; {$APPTYPE CONSOLE} uses Classes, SysUtils; procedure Split

Eclipse and Windows newlines

允我心安 提交于 2019-11-26 10:06:48
问题 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 changed a line or two! I could cook up a script, but I am wondering if it will mess up my Eclipse project files. 回答1: As mentioned here and here: Set file encoding to UTF-8 and line-endings for new files to Unix, so that text files are saved in a

Split function in oracle to comma separated values with automatic sequence

僤鯓⒐⒋嵵緔 提交于 2019-11-26 08:22:52
问题 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 table with columns Id and Data. Id column will contain sequence and data column will contain data of the string. Eg. SELECT*FROM Split(\'A,B,C,D\',\',\') Result Should be in below format: |Id | Data -- ---- |1 | A | |2 | B | |3 | C | |4 | D | 回答1: Here is how you could create such a table: SELECT

Angular JS custom delimiter

南楼画角 提交于 2019-11-26 08:02:07
问题 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? 回答1: You can use $interpolateProvider to change start / end symbols used for AngularJS expressions: var myApp = angular.module('myApp', [], function($interpolateProvider) { $interpolateProvider.startSymbol('[['); $interpolateProvider.endSymbol(']]'); }); and then, in your template: Hello, [[name]] Here is

MySQL: Split comma separated list into multiple rows

杀马特。学长 韩版系。学妹 提交于 2019-11-26 05:59:20
问题 I have an unnormalized table with a column containing a comma separated list that is a foreign key to another table: +----------+-------------+ +--------------+-------+ | part_id | material | | material_id | name | +----------+-------------+ +--------------+-------+ | 339 | 1.2mm;1.6mm | | 1 | 1.2mm | | 970 | 1.6mm | | 2 | 1.6mm | +----------+-------------+ +--------------+-------+ I want to read this data into a search engine that offers no procedural language. So is there a way to either

Convert Comma Separated column value to rows

余生颓废 提交于 2019-11-26 04:25:24
问题 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 with a select query in SQL Server? 回答1: try this SELECT A.[id], Split.a.value('.', 'VARCHAR(100)') AS String FROM (SELECT [id], CAST ('<M>' + REPLACE([string], ',', '</M><M>') + '</M>' AS XML) AS String FROM TableA) AS A CROSS APPLY String.nodes ('/M') AS Split(a); refer

changing the delimiter for cin (c++)

风流意气都作罢 提交于 2019-11-26 04:22:56
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? I went through the api in cplusplus.com, but didn't find anything. It is possible to change the inter-word delimiter for cin or any other std::istream , using std::ios_base::imbue to add a custom ctype facet . If you are reading a file in the style of /etc/passwd, the following program will read each : -delimited word separately. #include <locale> #include <iostream> struct colon_is_space : std:

JS string.split() without removing the delimiters [duplicate]

▼魔方 西西 提交于 2019-11-26 03:57:59
问题 This question already has an answer here: Split string into array without deleting delimiter? 5 answers 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\",\"e\"] But I want to get this: [\"abc\",\"d\",\"eabc\",\"d\",\"e\"] When I tried to do my \"split2\" function, I got all entangled in splice() and indexes and \"this\" vs \"that\" and .

How to make the &#39;cut&#39; command treat same sequental delimiters as one?

徘徊边缘 提交于 2019-11-26 03:47:10
问题 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 delimiter. I could have piped through awk awk \'{ printf $4; }\' or sed sed -E \"s/[[:space:]]+/ /g\" to collapse the spaces, but I\'d like to know if there any way to deal with cut and several delimiters natively? 回答1: Try: tr -s ' ' <text

Capturing output of find . -print0 into a bash array

☆樱花仙子☆ 提交于 2019-11-26 03:40:58
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 hard time actually making find's output useful within bash or with other command line utilities. The only way I have managed to make use of the output is by piping it to perl, and changing perl's IFS to null: find . -print0 | perl -e '$/="\0"; @files=<>; print $#files;' This example prints the number of files found, avoiding the danger of newlines in filenames corrupting the count, as would occur with