split

.Net DataTable column export

Im looking to get a column and all its row data from a DataTable object then create a new column in another data table and append it with the new column and its rows. The issue I keep encountering is the row data will come out, as will the column names, but all of the rows are appended to the same column, I'm sure im missing something ob...

Powershell: subtract $pwd from $file.Fullname

Scenario is: Given the following files c:\dev\deploy\file1.txt c:\dev\deploy\file2.txt c:\dev\deploy\file3.txt c:\dev\deploy\lib\do1.dll c:\dev\deploy\lib\do2.dll e.g. if $pwd is the following c:\dev\deploy running the statement $files = get-childitem I want to take this list and using << foreach ($file in $files) >> I want to subs...

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...

How to specify if a T4 file should produce any output

I am using T4 for generation of some DTO classes + mappers. I am splitting the files in a number of re-usable bits (some of which containing common methods, some others common procedures) and including them into the T4 templates that will produce my output - which is all good. My problem is that the re-usable .tt files will try and pro...

Optimized Generic List Split

Read the edit below for more information. I have some code below that I use to split a generic list of Object when the item is of a certain type. public static IEnumerable<object>[] Split(this IEnumerable<object> tokens, TokenType type) { List<List<object>> t = new List<List<object>>(); int currentT = 0; ...

Help with line.split CSV

Hi, I'm a beginner, so please don't blast my work so far :) I'm trying to read in a CSV file and then see if it matches certain commands. Some of the data in the CSV has a period and I think it's messing up when I'm trying to split it. When I try to dump my arrays to see what's there, it always gets cut off after the period. Here is a da...

Regex divide with upper-case

Hi, I would like to replace strings like 'HDMWhoSomeThing' to 'HDM Who Some Thing' with regex. So I would like to extract words which starts with an upper-case letter or consist of upper-case letters only. Notice that in the string 'HDMWho' the last upper-case letter is in the fact the first letter of the word Who - and should not be i...

Regarding Java Split Command CSV File Parsing

I have a csv file in the below format. I get an issue if either one of the beow csv data is read by the program "D",abc"def,"","0429"292"0","11","IJ80","Feb10_1.txt-2","FILE RECORD","05/02/2010","04/03/2010","","1","-91","","" "D","abc"def","","04292920","11","IJ80","Feb10_1.txt-2","FILE RECORD","05/02/2010","04/03/2010","","1","-91...

Splitting string only it meets requirements in C#

I'm trying to split a song title into two strings- the artist and song. I receive the original string like this: "artist - song". Using this code, I split the string using '-' as the spliiter: char[] splitter = { '-' }; string[] songInfo = new string[2]; songInfo = winAmp.Split(splitter); This works fine and all, except wh...

Removing empty items from a list (Python)

I'm reading a file in Python that isn't well formatted, values are separated by multiple spaces and some tabs too so the lists returned has a lot of empty items, how do I remove/avoid those? This is my current code: import re f = open('myfile.txt','r') for line in f.readlines(): if re.search(r'\bDeposit', line): print l...

php preg_split error when switching from split to preg_split

Hi, I get this warning from php after the change from split to preg_split for php 5.3 compatibility : PHP Warning: preg_split(): Delimiter must not be alphanumeric or backslash the php code is : $statements = preg_split("\\s*;\\s*", $content); How can I fix the regex to not use anymore \ Thanks! ...

SQL Split like Select

I have a field that contains values like: A12345 AB456 1234 AA 45 Is there anyway to Select these in two separate columns as Numbers and Letters. Thanks in advance ...

Splitting a string at every n-th character

In JavaScript this is how we can split a string at every 3-rd character "foobarspam".match(/.{1,3}/g) I am trying to figure out how to do this in Java. Any pointers? ...

how to remove whitespace while scanning text in java

I've implemented several different "scanners" in java, from the Scanner class to simply using String.split("\ss+") but when there are several whitespaces in a row like "the_quick____brown___fox" they all tokenize certain white spaces (Imagine the underscores are whitespaces). Any suggestions? ...

How do I re-wrap a paragraph to a certain line length?

I have a big paragraph which I need to split into lines such that each line must not have more than 100 characters and no words must be broken. How would I go about doing this? I guess with regular expressions is the best way but I'm not sure how. ...

How do I get the javascript split function to extract null values from a delimited string

I'm trying to parse a delimited string using the javascript split function. I'm using a double character delimiter. So for e.g. if the string contains employee related data with the following fields: Emp Id (mandatory) Name (mandatory) Age (optional) Mobile No (optional) and the delimiter used is |* (i.e. pipe followed by star) I m...

Split a string on commas not contained within double-quotes with a twist

I asked this question earlier and it was closed because it was a duplicate, which I accept and actually found the answer in the question Java: splitting a comma-separated string but ignoring commas in quotes, so thanks to whoever posted it. But I've since run into another issue. Apparently what I need to do is use "," as my delimiter wh...

SQL Server custom SplitString function with several splits.

Hey peeps. Thanks in advance! I have a Function in SQL server 2008 which splits a string based on the char i give. Lovely and simple. When I pass in: Content1,Content2,Content3 I can create a lovely temp table with those values in a single column split by the comma (,). Now, that's all good, but I now need to split the following in...

Highlighting long sentences using jQuery

I'd like to highlight long sentences (say, 50 words or greater) contained in an array of paragraph objects on a page, ie $("#content p"). I'm not sure how to tackle this. I originally tried to highlight all sentences, but ran in trouble when they contained HTML tags (example highlighting code on the net seem to be for individual words o...

In Perl, what is the sane way for converting a string into a list of its characters?

I have been wondering if there's a nicer, but concise way for splitting a string into its characters @characters = split //, $string is not that hard to read, but somehow the use of a regular expression looks like overkill to me. I have come up with this: @characters = map { substr $string, $_, 1 } 0 .. length($string) - 1 but I f...