split

Splitting a String (especially in Java with java.util.regex or something else) ...

Does anyone know how to split a string on a character taking into account its escape sequence? For example, if the character is ':', "a:b" is split into two parts ("a" and "b"), whereas "a\:b" is not split at all. I think this is hard (impossible?) to do with regular expressions. Thank you in advance, Kedar ...

Can I use XSLT to parse XML into sub-files? (+ Alternative Languages/Methods)

Hey all, I have highly repetitive data with a depth of 5 nodes deep (including the root) that needs to be broken apart. (I'll include a fast sample in a minute.) What I'm looking to do is parse a ~5mb XML file into smaller sub-files based on the 3rd-depth nodes. But after that, it gets more complicated. The task's requirements are these...

How do I split a log file with an offset value in unix?

Hi, I have a really big log file (9GB -- I know I need to fix that) on my box. I need to split into chunks so I can upload it to amazon S3 for backup. S3 has a max file size of 5GB. So I would like to split this into several chunks and then upload each one. Here is the catch, I only have 5GB on my server free so I can't just do a simp...

Split a html into words

Assume I have the following string: Hellotoevryone<img height="115" width="150" alt="" src="/Content/Edt/image/b4976875-8dfb-444c-8b32-cc b47b2d81e0.jpg" />Iamsogladtoseeall. This string represents a sequence of chars that are not separated by a space, in this string there is also an html image inserted. Now I want to separate the str...

How to open a new window below a split created by vimdiff?

If, at a command prompt, I run vimdiff file1 file2 I get a vim instance that has two files open side-by-side, something like this: ╔═══════╤═══════╗ ║ │ ║ ║ │ ║ ║ file1 │ file2 ║ ║ │ ║ ║ │ ║ ╚═══════╧═══════╝ This is very nice, but sometimes I want to open a third file to look at. I d...

How do you parse a paragraph of text into sentences? (perferrably in Ruby)

How do you take paragraph or large amount of text and break it into sentences (perferably using Ruby) taking into account cases such as Mr. and Dr. and U.S.A? (Assuming you just put the sentences into an array of arrays) UPDATE: One possible solution I thought of involves using a parts-of-speech tagger (POST) and a classifier to determ...

Getting the longest string (ending by a newline) out of a Textarea in Flex

Hi, This somehow simple task is not so simple. I can get the number of lines of the textarea using mx:internals, but thats is not always the longest line ending by a newline. I tried all sort of textArea.text.split("\n") \r <br/> {/n .. It always returns me the length of 1. My eternal worshipping to anyone who can put me in the righ...

Using escaped_list_separator with boost split

I am playing around with the boost strings library and have just come across the awesome simplicity of the split method. string delimiters = ","; string str = "string, with, comma, delimited, tokens, \"and delimiters, inside a quote\""; // If we didn't care about delimiter characters within a quoted section we could us vector<s...

Split SMS gateway answer in PHP

Hi I am wondering what other approaches you would take to do some simple string splitting in PHP. I am receiving a response from a SMS gateway where two of the interesting values are the code used and the users text message. The code could be something like: Freetrip (lowercase, uppercase, mixed case) The user message should in the be...

Split string, convert ToList<int>() in one line...

I have a string has numbers string sNumbers = "1,2,3,4,5"; Split it then Convert To List sNumbers.Split( new[] { ',' } ).ToList<int>(); How can i convert string array to integer list? So i need to convert string[] to IEnumerable ... ...

Split a html code in two equal content parts, in PHP or JS

I want to take the content of a website article and create two or more columns of text. The difficult part is that i must keep the html tags and also close them if the cutting is done inside a <p></p> for example. Example: <p><span>One two three <strong>four</strong></span> five six</p> Result: <p><span>One two three<span><p> <p><s...

Tokenizing Error: java.util.regex.PatternSyntaxException, dangling metacharacter '*'

I am using split() to tokenize a String separated with * following this format: name*lastName*ID*school*age % name*lastName*ID*school*age % name*lastName*ID*school*age I'm reading this from a file named "entrada.al" using this code: static void leer() { try { String ruta="entrada.al"; File myFile = new File (ruta...

split() method fail

I'm reading a text file with the following format: Room1*Exposition*Work 1 | Work 2 | Work 3 | Work n Room2*Exposition*Obra 1 | Work 2 | Work 3 | Work n Using the following: try { String path="contenidoDelMuseo.txt"; File myFile = new File (path); FileReader fileReader = new FileReader(myFile); ...

splitting a string into a list in specman

Supposing I have a string: str = “ab,cd,ef” and I want to split it into a list lst = [“ab”,”cd”,ef”] How can I do it best, assuming that I don’t know ahead of time how many items are in the string? Basically I'm looking for a specman equivalent to Perl's: $str = "ab,cd,ef"; @lst = split /,/, $str; ...

NHibernate inheritance and split table

i have a table stracture which lends itself to table per subclass design. my "base" table has many common fields and each one of the children also has many fields that are unique for that entity. this works very well with joined-sublass where the common fields are added to the child entities through inheritance. the base is linked to the...

How remove empty element from string array in one line?

string[] ssss = "1,2,,3".Split(new[] {','}).Where(a=>!string.IsNullOrEmpty(a)).Select() How does this works? ...

Is there an equivalent to Perls' split() function in C?

I'm trying to split real numbers in a C program using the decimal point as the delimter such that such that say, 1234.56 yields (int) whole_num = 1234 (int) fraction = 56 Any ideas how I can go about doing this? Its been a loooong while since I mucked around with C, see? :) ...

Split CSV String

How would I split the following string? test, 7535, '1,830,000', '5,000,000' The result should be test 7535 '1,830,000' '5,000,000' I try: Dim S() as string = mystring.split(",") But I get, test 7535 '1 830 000' '5 000 000' Thanks ...

De / Interleave array fast in C#

Hi guys, I am looking for the fastest way to de/interleave a buffer. To be more specific, I am dealing with audio data, so I am trying to optimize the time I spend on splitting/combining channels and FFT buffers. Currently I am using a for loop with 2 index variables for each array, so only plus operations, but all the managed array ch...

Replicating String.split with StringTokenizer

Encouraged by this, and the fact I have billions of string to parse, I tried to modify my code to accept StringTokenizer instead of String[] The only thing left between me and getting that delicious x2 performance boost is the fact that when you're doing "dog,,cat".split(",") //output: ["dog","","cat"] StringTokenizer("dog,,cat") // ...