split

listbox example

How can I add a values to a listbox from a textbox each time a space is pressed (split textbox value on space) ...

Split with single colon but not double colon using regex

Hi, I have a string like this "yJdz:jkj8h:jkhd::hjkjh" I want to split it using colon as a separator, but not a double colon. Desired result: ("yJdz", "jkj8h", "jkhd::hjkjh") I'm trying with: re.split(":{1}", "yJdz:jkj8h:jkhd::hjkjh") but I got a wrong result. In the meanwhile I'm escaping "::", with string.replace("::", "$$") ...

C#: Split a string (or user input) into individual characters withOUT using an array?

Ok here's what im trying to do. The user is prompted to enter an 8 digit number (7 numbers plus a hyphen 781-0432 I want it to break it apart and store it into 8 separate char variables without using an array: a = 7 b = 8 c = 1 ... h = 2 Ive been trying to do it with the Console.Read() method: a = Console.Read(); b = Console.Read();...

Need code to return directory name only

I am a python newbie and have obtained a script that lets the user input a directory where shapefiles are located (ex., c:\programfiles\shapefiles). It then creates a field within each shapefile and adds the directory path that was input and the shapefile name (ex., c:\programfiles\shapefiles\name.shp). I would like to populate the field...

Split pane using CSS3 Resize property

Hello, I've been trying to do split pane resizing using the CSS3 property. Here is the code: <style> div.left, div.right {float: left; outline: solid 1px #ccc; resize: both; overflow: auto;} div.left {width: 20%} div.right {width: 80%} </style> <div class="left"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. </div>...

Split string to equal length substrings in Java

How to split the string "Thequickbrownfoxjumps" to substrings of equal size in Java. Eg. "Thequickbrownfoxjumps" of 4 equal size should give the output. ["Theq","uick","brow","nfox","jump","s"] Similar Question: Split string into equal-length substrings in Scala ...

Understanding regex in Java: split("\t") vs split("\\t") - when do they both work, and when should they be used..

Hi, I have recently figured out that I haven't been using regex properly in my code. Given the example of a tab delimited string str, I have been using str.split("\t"). Now I realize that this is wrong and to match the tabs properly I should use str.split("\\t"). However I happen to stumble upon this fact by pure chance, as I was looki...

Split string suppressing all null fields

I want to split a string suppressing all null fields Command: ",1,2,,3,4,,".split(',') Result: ["", "1", "2", "", "3", "4", ""] Expected: ["1", "2", "3", "4"] How to do this? Edit Ok. Just to sum up all that good questions posted. What I wanted is that split method (or other method) didn't generate empty strings. Looks lik...

[php] Split string and get delimiter as return as well.

I would like to split a string by an array of delimiters, and also get feedback what the delimiter was. Example: $mystring = 'test+string|and|hello+word'; $result = preg_split('/\+,|/+', $mystring); I would like an array as return with something like this: $return[0] = array('test','+'); $return[1] = array('string','|'); thnx in adv...

Explode a string to an array

Probably easy to do but I can't seem to generate the correct regex. Say I have this string $string = '<h2>Header 1</h2><p>ahs da sdka dshk asd haks</p><img src="http://dummyimage.com/100x100/" width="100" height="100" alt="Alt" /><h2>Header 2</h2><p>asdkhas daksdha kd ahs</p><em>Lame</em><p>trhkbasd akhsd ka dkhas</p><h2>Header 3</h2><...

Regex to split BBCode into pieces

str = "some html code [img]......[/img] some html code [img]......[/img]" I want use regex get the array: ["[img]......[/img]","[img]......[/img]"] Any ideas anyone? ...

Splitting a string in Java

When I split the string "1|2|3|4" using the String.split("|") I get 8 elements in the array instead of 4. If I use "\\|" the result is proper. I am guessing this has something todo with regular expressions. Can anybody explain this? ...

split string from string

I have a string that contains <name>James Jones</endofname> how would i get the name from the centre pragmatically. Thanks James ...

How to parse an Xml-like tag with regular expression

I need to tokenize following tag: {TagName attrib1=”value1” attrib2=”value 3”}. I would like to write regex to do it, but the trouble is that attribute value can contain space, so I can’t just split with space. ...

Split/break a File in to pieces in J2ME

Hi, I need to split an audio or large image file in J2ME before uploading it. How can i split/ break a file in to pieces in JavaME. Regards, Imran ...

Preg_match for a date

Hello everyone, I am trying to match a date in PHP using preg_match, split it and assign parts of it to an array, the date looks like "20100930", here is the code I am using: // Make the tor_from date look nicer $nice_from = $_POST['tor_from']; $matches = array(); $ideal_from = ''; preg_match('/\d{4}\\d{2}\\d{2}\/', $nice_from, $matc...

Grails: Splitting a string that contains a pipe

Hi, Im trying to split a string. Simple examples work groovy:000> print "abc,def".split(","); [abc, def]===> null groovy:000> Instead of a comma, I need to split by pipes, but i'm not getting the desired result. groovy:000> print "abc|def".split("|"); [, a, b, c, |, d, e, f]===> null groovy:000> Of course, my first choice would be...

Splitting string into an array in PHP

Hello, I want split a string which consists of products. Each product is encloded within {..}, and separated by comma. For instance, I have a strin below. [ {\"productid\" : \"prod:kj42j3d24-47c2-234lkj2-e3c2-cfc9a4a3b005\",\"memo\" : \" product description \",\"taxable\" : 0,\"unitweight\" : 0,\"unitcost\" : 0,\"unitprice\" : 12.34,...

Triangularizing an arbitrary 4-Vertex Polygon

Here's a riddle for you. You have a polygon composed of exactly 4 vertices, call them v1, v2, v3, v4. They are given in any random order. How would you split these vertices into two sets, each defining a triangle, such that both triangles make up the polygon without overlap. The result should look like this: Triangle 1: v1, v2, v3 Tri...

Ruby: OptionParser: String Arg & Hash Assignment

Using OptionParser for string argument input and hash assignment. What is the best way to read-in multiple variables for a single argument? How do I then assign those to a hash to reference? Here is what I have so far: large_skus = Hash.new small_skus = Hash.new OptionParser.new do |opts| opts.on("-b", "--brands bName1,bName2,bName...