split

C++ tokenize a string using a regular expression

Hi, I'm trying to learn myself some C++ from scratch at the moment. I'm well-versed in python, perl, javascript but have only encountered C++ briefly, in a classroom setting in the past. Please excuse the naivete of my question. I would like to split a string using a regular expression but have not had much luck finding a cle...

How could I rewrite this to remove the gotos without loss of speed or readability?

I wrote this. Yes, I know it's VB6. Yes, it is production code, and, yeah, I know it uses gotos. I am a lazy, evil beast ... So show me (and the rest of us) how it should be written Public Function SplitString(ByVal sText As Variant) As Variant Dim nHere As Long Dim cHere As String * 1 Dim aRes As Variant Dim nRes As L...

C# Regex Split To Java Pattern split

I have to port some C# code to Java and I am having some trouble converting a string splitting command. While the actual regex is still correct, when splitting in C# the regex tokens are part of the resulting string[], but in Java the regex tokens are removed. What is the easiest way to keep the split-on tokens? Here is an example of ...

.net Split by length

I have a string value that its length is 5000 + characters long , i want to split this into 76 characters long with a new line at the end of each 76 characters. how woudld i do this in c#? ...

split a string by a delimiter in a context sensitive way

For example, I want to split str = '"a,b,c",d,e,f' into ["a,b,c",'d','e','f'] (i.e. don't split the quoted part) In this case, this can be done with re.findall('".*?"|[^,]+',str) However, if str = '"a,,b,c",d,,f' I want ["a,,b,c",'d','','f'] i.e. I want a behavior that is like python's split function. Is there any way ...

How to split HTML textarea element into array of lines in Java

How to split HTML textarea element into array of lines in Java ...

Splitting text

I want to know is there any way to split text like this: 123456789 into 123-456-789 as to add "-" after every 3 characters? Just wanted to know, as I know the reverse, but how to do this is over my head. ;) and also if the text is ABCDEFGHI OR A1B2C3D4E or any other format without any space between the characters ! languge : PHP...

Cursor disappears in vim when switching windows between vertical and horizontal split

I've been switching some windows in VIM from vertical to horizontal splits and back using: CTRL-W + K CTRL-W + L CTRL-W + J CTRL-W + H After doing this a few times the cursor disappeared. I can still type, and the status bar at the bottom still shows me my location, but there's no blinking cursor. Any ideas regarding: Why does thi...

separate searches in windows in VIM

When I split VIM to show me a few files or a different parts of the same file, is there any way for me to have one search in one window and a different search in another one? For instance, I'd like the upper window to have the search pattern foo and the lower window to have the search pattern bar. The active search pattern affects what...

Styling a YUI Split button

I want to use split buttons for a left side menu. I tried adding the class following. <STYLE TYPE="text/css"> .catbutton { display: block; } </STYLE> The buttons were the right width but the menu arrow was the section taking up the variable width. Not only was it ugly but the menu activation section was in the correct place on the far...

Perl loop stuck reading file?

Closing this question. Will drink red bull. Sleep. Code and come back with brand spanking new question with unit test cases. UPDATE: The new file is here Also the config file is here I refactored the code again: sub getColumns { open my $input, '<', $ETLSplitter::configFile or die "Error opening '$ETLSpliter::configFile':...

C# string split

Hello! I have a string = "google.com 220 USD 3d 19h". I want to extract just the ".com" part....... whats the easiest way to manipulate the split string method to get this result? ...

Context-sensitive string splitting, preserving delimiters

I have a string of the form "foo-bar-1.23-4", and I need to split at the first hypen followed by a numeral, such that the result is ['foo-bar', '1.23-4']. I've tried the following: >>> re.split('-\d', 'foo-bar-1.23-4', 1) ['foo-bar', '.23-4'] and >>> re.split('-(\d)', 'foo-bar-1.23-4', 1) ['foo-bar', '1', '.23-4'] with suboptimal r...

Splitting a string @ once using different seps

datetime = '0000-00-00 00:00:00'.split('-') Right now it just splits it at the hyphen, but is it possible to split this string at both -'s and :'s ? ...

Assign Variables from Split

Okay, so I have this string, it's "x/y". How can I use the split function to rid the / and assign the x to myVariable and assign the y to myVariable2 ...

Split String at specific line for NSString

Hello ist there a way to split a String for UITableView at a specific line to put the "rest" (the second part of the data) in an own cell NSString *data; CGsize *size = [data sizeOfStringWithFont:[UIFont systemFontOfSize:14] constrainToWidth:280.0]; if the size.height e.g. is greater than 1500 i want to split the string at this li...

Best way to split an address line into two fields

We are developing a c# application that imports address-data into a CRM-system. The CSV-file contains an address-column like 'Somethingstreet 34'. Our CRM however uses two different fields for the streetname and the housenumber. Of course, in the given example this poses no problem. But our Dutch addressing-system can be a bit of a pain....

Python strings split with multiple separators

Weird - I think what I want to do is a fairly common task but I've found no reference on the web. I have text, with punctuation, and I want an array of the words. i.e - "Hey, you - what are you doing here!?" should be ['hey', 'you', 'what', 'are', 'you', 'doing', 'here']. But python's split() only works with one argument... so I have all...

How can I split a string if it is a MS-DOS type path OR Unix type path?

I have a string that represents a path to a directory. I want split the string if it is a unix type path or a ms-dos type path. How can this be done? For example: <?php $a = some_path1/some_path2/some_path3; // unix type path $b = some_path1\some_path2\some_path3; // MS-DOS type path $foo = preg_split("something", $a); // what rege...

Java regex split

I have some data formated like the following 2009.07.02 02:20:14 40.3727 28.2330 6.4 2.6 -.- -.- BANDIRMA-BALIKESIR 2009.07.02 01:38:34 38.3353 38.8157 3.5 2.7 -.- -.- KALE (MALATYA) 2009.07.02 00:10:28 38.8838 26.9328 3.0 3.0 -.- -.- CANDARLI KÖRFEZI (EGE DENIZI) 2009.07.01 23:3...