string-split

T-SQL Split string into many-to-one relationship?

I have the following SQL script: DECLARE @temp table ( ID int IDENTITY(1, 1), data nvarchar(100) ) INSERT INTO @temp (data) VALUES ('a,b,c') INSERT INTO @temp (data) VALUES ('d,e,f') SELECT * FROM @temp AS T INNER JOIN (SELECT * FROM dbo.__StringSplit(T.data, ',', T.ID)) AS S ON T.ID = S.RefID And on ...

LINQ to Entities: Why can't I use Split method as condition?

Hi, I have the following LINQ query: var aKeyword = "ACT"; var results = from a in db.Activities where a.Keywords.Split(',').Contains(aKeyword) == true select a; Keywords is a comma delimited field. Everytime I run this query I get the following error: "LINQ to Entities does not recognize the method 'Boo...

How to split a string with a delimiter larger than one single char?

Hi, Supposing I have this: "foo bar 1 and foo bar 2" How can I split it into: foo bar 1 foo bar 2 ? I tried strtok() and strsep() but neither worked. They don't recognize "and" as delimiter, they recognize "a", "n" and "d" as delimiters. Any function to help me with this or I'll have to split by the blank space and do some strin...

How to read values from file. tokenizer

I have a file in which each line contains two numbers. The problem is that the two number are separated by a space, but the space can be any number of blank spaces. either one, two, or more. I want to read the line and store each of the numbers in a variable, but I'm not sure how to tokenize it. i.e 1 5 3 2 5 6 3 4 83 54 23 ...

Java StringTokenizer, empty null tokens

I am trying to split a string into 29 tokens..... stringtokenizer won't return null tokens. I tried string.split, but I believe I am doing something wrong: String [] strings = line.split(",", 29); sample inputs: 10150,15:58,23:58,16:00,00:00,15:55,23:55,15:58,00:01,16:03,23:58,,,,,16:00,23:22,15:54,00:03,15:59,23:56,16:05,23:59,15:55...

need help with splitting a string in python

Hi, I am trying to tokenize a string using the pattern as below. >>> splitter = re.compile(r'((\w*)(\d*)\-\s?(\w*)(\d*)|(?x)\$?\d+(\.\d+)?(\,\d+)?|([A-Z]\.)+|(Mr)\.|(Sen)\.|(Miss)\.|.$|\w+|[^\w\s])') >>> splitter.split("Hello! Hi, I am debating this predicament called life. Can you help me?") I get the following output. Could someone...

How to split a CamelCase string in its substrings in Ruby?

Dear Stackoverflow, I have a nice CamelCase string such as ImageWideNice or ImageNarrowUgly. Now I want to break that string in its substrings, such as Image, Wide or Narrow, and Nice or Ugly. I thought this could be solved simply by camelCaseString =~ /(Image)((Wide)|(Narrow))((Nice)|(Ugly))/ But strangely, this will only fill $1 a...