explode Questions

3

Solved

Say I have the following: 44-xkIolspO I want to return 2 variables: $one = "44"; $two = "xkIolspO"; What would be the best way to do this?
Gadson asked 19/1, 2011 at 3:0

6

Solved

I want to let the user type in tags: windows linux "mac os x" and then split them up by white space but also recognizing "mac os x" as a whole word. Is this possible to combine ...
Rajkot asked 19/12, 2009 at 9:56

19

Solved

The following code: $string = "1,2,3" $ids = explode(',', $string); var_dump($ids); Returns the array: array(3) { [0]=> string(1) "1" [1]=> string(1) "2" [...
Ithaca asked 6/3, 2012 at 23:52

9

Solved

I need to split my string input into an array at the commas. Is there a way to explode a comma-separated string into a flat, indexed array? Input: 9,[email protected],8 Output: ['9', 'admin@e...
Illumination asked 14/7, 2009 at 14:21

8

Solved

I have a PHP array of numbers, which I would like to prefix with a minus (-). I think through the use of explode and implode it would be possible but my knowledge of php is not possible to actually...
Cinnamon asked 1/10, 2011 at 1:50

2

Solved

I have a function which returns a list type column. Hence, one of my columns is a list. I'd like to turn this list column into multiple columns. For example: use polars::prelude::*; use polars::df;...
Winterkill asked 3/6, 2022 at 13:24

4

Solved

In javascript, var myStringToArray = myString.split(''); is perfectly acceptable. But in PHP, $My_String_To_Array = explode('', $My_String); throws an error: Warning: explode() Empty delimiter ...
Cranwell asked 11/4, 2017 at 13:29

6

Solved

Is there any way to explode() using an array of delimiters? PHP Manual: array explode ( string $delimiter , string $string [, int $limit ] ) Instead of using string $delimiter is there any way to...
Mcatee asked 18/5, 2010 at 19:4

2

I am using the spark libraries in Scala. I have created a DataFrame using val searchArr = Array( StructField("log",IntegerType,true), StructField("user", StructType(Array( StructField("date",S...
Hour asked 30/6, 2015 at 13:42

8

Solved

$str = "This is a string"; $words = explode(" ", $str); Works fine, but spaces still go into array: $words === array ('This', 'is', 'a', '', '', '', 'string');//true I would prefer to have wor...
Glaciology asked 5/9, 2013 at 14:15

10

Solved

I want to count the words in a specific string so that I can validate it and prevent users to write more than, for example, 100 words. I wrote this function, but I don't think it's effective enough...
Gaskell asked 24/1, 2011 at 20:27

6

Solved

I have a set of numbers in a table field in database, the numbers are separated by comma ','. I am trying to do the following: Step 1. : SELECT set of numbers from database and explode it to array...
Concelebrate asked 27/4, 2013 at 21:32

11

Solved

I need to split a string into two parts. The string contains words separated by a space and can contain any number of words, e.g: $string = "one two three four five"; The first part...
Tape asked 27/3, 2012 at 14:41

8

Solved

How can I explode a string by one or more spaces or tabs? Example: A B C D I want to make this an array.
Mateusz asked 24/11, 2009 at 21:12

4

Solved

preg_match() gives one match. preg_match_all() returns all matches. preg_split() returns all splits. How can I split only on the first match? Example: preg_split("~\n~", $string); This i...
Stagey asked 3/11, 2009 at 16:0

4

Solved

I have a string like this: key1\value1\key2\value2\key3\value3\key4\value4\key5\value5 And I'd like it to be an associative array so that I can do: echo $myArray['key1']; // prints value1 echo ...
Allfired asked 13/3, 2011 at 15:32

2

Solved

I'm trying to explode an string by comma's: , but only when it's not between parenthesis (...) Here's some code to show what I mean: $string = "K.VisueelNr,IFNULL(P.Partijnaam, 'Leeg gemeld') AS ...
Sumerlin asked 25/6, 2015 at 5:44

6

Solved

The string input comes from textarea where users are supposed to enter every single item on a new line. When processing the form, it is easy to explode the textarea input into an array of sin...
Doviedow asked 16/2, 2010 at 16:37

10

Lets say I have a string: $string = "This is my test case for an example." If I do explode based on ' ' I get an Array('This','is','my','test','case','for','an','example.'); What I want is an...
Borgeson asked 8/5, 2009 at 16:53

2

Solved

I have a panda dataframe with different set of values like first one is an list or array and other elements or not >>> df_3['integration-outbound:IntegrationEntity.integrationEntityDetails...
Iphlgenia asked 9/7, 2020 at 23:5

8

Solved

I've got some data that needs to be cleaned up into a fixed length format. I'm using PHP to grab the data out, covert it, and put it back in, but it's not working as planned. There is a certain poi...
Caption asked 1/4, 2011 at 15:40

5

Solved

I have a hive table with the following schema: COOKIE | PRODUCT_ID | CAT_ID | QTY 1234123 [1,2,3] [r,t,null] [2,1,null] How can I normalize the arrays so I get the following result COOKIE | ...
Owlet asked 18/12, 2013 at 20:11

1

I'm doing an nlp project and have reviews that contain multiple sentences. I am using the spark-nlp package that outputs one column containing a list of the sentences in each review. I am usi...
Reynalda asked 9/6, 2020 at 15:46

3

Solved

There was a question regarding this issue here: Explode (transpose?) multiple columns in Spark SQL table Suppose that we have extra columns as below: **userId someString varA varB varC varD** 1...
Chippy asked 29/7, 2017 at 6:40

1

Solved

In Spark, for the following use case, I'd like to understand what are the main differences between using the INLINE and EXPLODE ... I'm not sure if there are any performance implications or if one ...
Tideway asked 27/5, 2020 at 22:22

© 2022 - 2024 — McMap. All rights reserved.