As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [split]

Use this tag for questions about separating an item (e.g. a string) into parts, often by a delimiter or regular expression.

Filter by
Sorted by
Tagged with
0 votes
1 answer
8 views

SPLIT_PART function fails when querying result from pg_get_cols()

I'm trying to extract column name studyid,domain,usubjid from data below, by running this query: select split_part(pg_get_cols,',',3) from ( select pg_get_cols('dmhair') ) The data which i'...
alterego's user avatar
  • 197
-3 votes
2 answers
41 views

AWK compare two rows by specific column and print uniqely by split

I would like to compare specific column ($3) of two rows in sorted file. If there is match split ($10 to $100) columns by ','. For first matched row print before comma and for second match print after ...
Vonton's user avatar
  • 2,822
-1 votes
0 answers
30 views

Splitting a PHP string containing a array into seperate strings of arrays with individual values [duplicate]

I am seeking a simpler way to achieve the outcome to split the Json string retrieved from database and splitting it into combinations of 2. I tried json_decode and that can achieve the outcome in a ...
aLamp's user avatar
  • 57
0 votes
0 answers
18 views

Splitting a log file where line contains a specific string

I'm wanting to split a log file that isn't a log file from start to end, the file itself is structured in a way that it has multiple start points, the start points are also end point indicators as the ...
AeroMaxx's user avatar
  • 213
0 votes
1 answer
29 views

Converting formula variables to variable names with regex operations

I ma trying to convert the variable Formula_bit into variable like names where they are lowercase and words are seperated by _. My Process is as follows splitting the right-hand side by operators (+, -...
Teoman Selcuk's user avatar
0 votes
3 answers
35 views

How to get first string value with numbers in pyspark array

I want to extract just the first numeric instance from the languages field as a date in another column of the pyspark dataframe. Sample data data = [ ("James","Java_Scala_C++...
SunflowerParty's user avatar
0 votes
1 answer
22 views

Trouble splitting date-time columns and avoiding chr type + time always adds todays date

I am on a case study for a Analytics course. I loaded various csv-files into R along with common libraries to use such as tidyverse, janitor etc. Now, I have 2 datasets that have date-time in one ...
Patrick's user avatar
-3 votes
0 answers
44 views

What is an alternative to the split function? [closed]

What is an alternative to the split function in the latest version of PyCharm? When I run code that includes the split function, the output is like this: Traceback (most recent call last): File &...
Abdullah Alqahtani's user avatar
-1 votes
0 answers
36 views

Split string into lines without trim [duplicate]

In the screenshot given below, I am splitting string into each line which is given in textarea on left hand side. I have tried explode, regex, nl2br and other techniques but it always trims the extra ...
Frank Martin's user avatar
  • 3,116
0 votes
2 answers
27 views

How do I derive the surnames of everyone whose first names have a condition in a pandas data frame?

Using pandas, I want to derive a last name column for a set of first names that are 4 or more characters long. I have tried these: data = pd.read_csv("Data.csv") data #split the ...
Bumze's user avatar
  • 1
0 votes
1 answer
75 views

How to split a massive text file with header while deleting original file?

I have a massive, pipe-delimited .txt file (300 GB) that I'm trying to split into 1 GB files for further analysis in Python. My PC does not have enough space for another 300 GB, though, so I would ...
resourcefulodysseus's user avatar
0 votes
2 answers
77 views

How to split a list into exactly n randomly sized parts

I have to split a list of size >n (e.g.: lst = [1,2,3,4,5,6,7,8]) into exactly n randomly sized chunks (sublists), (e.g. chunks = [[1,2,3],[4],[5,6,7,8]]. The elements in the list are unique. The ...
funkephi's user avatar
2 votes
5 answers
80 views

How can I split a string into character labels and numeric values in R?

Struggling newbie here, please pardon ungraceful explanations, and let me know what I need to clarify. I have an object that like this, a vector of strings: "aaaa,1,1,1,1,0" "abba,0,0,...
chill's user avatar
  • 25
1 vote
1 answer
43 views

How to split with Powershell with an XML string in it

I am trying to split data from a file using the first : colon. Which is not a problem except my file has a section with a data field that has xml data in it making the split not work on that line ...
MikeC's user avatar
  • 37
0 votes
0 answers
16 views

Propositional Logic formula from string to QCIR gate format [closed]

I am currently working on some research and I have never used rust before, but I feel this problem is more just logic and algorithm knowledge and not rust specifically. My goal is to take a string as ...
pshevchen's user avatar
2 votes
3 answers
49 views

Split a vector Into Some Overlapping Number of Subvectors With the following Conditions

I want to split a vector into subvectors with the following: g conditions: Each sub-vector has an equal length l which is less than the number of the parent vector v. Each sub-vector is unique in ...
Daniel James's user avatar
  • 1,369
-6 votes
0 answers
46 views

in java how to use split()function [closed]

I am doing the string program to split the strings for example "HelloWorld" will display the result as Hello World using split() or any other way can you say about it I am expected to be ...
vidhya25's user avatar
0 votes
1 answer
44 views

How to split a string in python including whitespace? [duplicate]

Final result should look like this: string = "this is a simple text" result = ["this", " ", "is", " ", "a", " ", "simple"...
nofamenoname's user avatar
1 vote
1 answer
35 views

Spliting Strings by regex seems not to work as expected

Having a function in PowerShell: function WriteToLog { [CmdletBinding()] param( [Parameter(Mandatory, ValueFromPipeline)] [AllowEmptyCollection()] [AllowEmptyString()] ...
Thomas Schweikle's user avatar
0 votes
0 answers
30 views

VBA Formatting Data with Split Function

I am trying to remove extraneous information from a column of data. For example: 1 Data -> Data 2 Data -> Data 3 Data -> Data Using split method I have done this, but it leave the extraneous ...
Max Pizzimenti's user avatar
0 votes
1 answer
26 views

how to split a column values into separate columns?

I have a txt file, details.txt, like this: name class school a 1 sec b 2 pri c 3 hrsec I want the values separated by space as different columns. so column 1 should be name a b c column 2 ...
priya darshini's user avatar
-1 votes
1 answer
61 views

Split string in row into separate string (into a column) [closed]

SQL Query: Input: | Company | | --------| | APPLE | | GOOGLE | Needed Output: |One | Two | |----------| | A | G | | P | O | | P | O | | L | G | | E | L | | | E | ...
gul's user avatar
  • 1
0 votes
0 answers
19 views

QString.split missing some empty lines

I'm stuck with this. I am trying to tokenize a multiline QString and count the number of lines. QStringList sentences = m_text.split(QRegularExpression("\n|$"), Qt::SkipEmptyParts); qDebug() ...
coterobarros's user avatar
0 votes
1 answer
31 views

Split comma separated value and insert into new columns on each row

I have a table where one of the columns, fullname is a comma separated value. For example, one of columns has first_name, last_name. I need to add two new columns, firstname and lastname to the table ...
dakini's user avatar
  • 728
-1 votes
2 answers
25 views

How to turn string into objects with properties

I'm fetching a string that looks like this Ebonie Rangel 7175 Yukon Street (507) 833-3567 Geography Keenan Ellwood 2 Elm Lane (894) 831-6482 History Kailan Smart 795 Harvard Street (925) 856-5167 ...
Milos's user avatar
  • 569
-1 votes
0 answers
29 views

How to explain the emergence of empty strings in re.split() output using Python 3.x regex? [duplicate]

Consider the output of the following code in Python import re a=re.split(r'\W*', '...words...') b=re.split(r'(\W*)', '...words...') print(a) print(b) and the output is a: ['', '', 'w', 'o', 'r', 'd', ...
user914799's user avatar
2 votes
6 answers
93 views

String_Split multiple columns

I need to split values of two columns in a table with separated values. My source table looks like: product_id ean_upc is_approved 2102961 8710103368021;8710103368038;8710103368014 1;0;1 92923683 ...
Joachim Siebert's user avatar
-1 votes
1 answer
43 views

How to split a string and breaking it to an array? [duplicate]

How to split a string and breaking it to an array? I have an string as shown below 1234,1243,"555,552,553" Using JavaScript, what is the fastest way to split the string and achieve below ...
darshan-ranganath's user avatar
-1 votes
0 answers
33 views

How to split a string into words, manipulate the words (e.g. capitalize specific words) and put the modified string back together?

i am new to Python and am stuck on how to manage to change the string "please write your grocery shopping list" into "please WRITE your GROCERY shopping LIST". The hint to my task ...
vasi 's user avatar
  • 11
0 votes
2 answers
68 views

Powershell convert unordered Text to CSV

I have a system that exports a text file [.txt] and wish to convert the text to a .csv file. The export contains 500+ lines so manual manipulation in Excel is very slow. I have no means of changing ...
Root User's user avatar
0 votes
0 answers
12 views

HBase region split didn't happen when it exceeds the size

The HBase region split is not happening when the existing region storefile size reached its configured size. In my case, the configured size is 10 GB but it is not split even when the size grows ...
Mohan's user avatar
  • 91
0 votes
5 answers
87 views

How to return the correct position in an array in Javascript?

I need to make a function so that it will return the starting and ending index of the widest pasture as well as the width. It needs to return an array in this particular order. [length, starting_index,...
AtomicCow's user avatar
-1 votes
1 answer
36 views

split multidimensional array in python

I created a multidimensional array in python. It is an array of arrays with size (100,91). I need to create a list of subarrays, with pre-specified length. I need to code it in a flexible way. The ...
Dreamer93's user avatar
0 votes
1 answer
26 views

There is a string which I want to split using "-" by JavaScript [closed]

CTO-Office - Production - Engineer from the given string i want to split them based on hyphen (-) but the CTO-Office should remain same. My answer should be like : 0th Index CTO-Office, 1st Index ...
Mohammad Irfan's user avatar
2 votes
3 answers
98 views

Need to skip different number of rows in R

I am using the following code for processing my data but lately I realized that using skip = 27 (to skip the information stored in my files before the data starts, is not a good option because the ...
Alexia k Boston's user avatar
-2 votes
1 answer
26 views

Split value into different variables, after a certain character nth [duplicate]

Let's say I have this value 'BERNY564567JH89E'. How would I split the value into different strings, after the 11th character, which in this case would be 7. So for example, in the end I would have the ...
The Interactive DOM's user avatar
0 votes
1 answer
25 views

how to keep everything before "." in R using sub [duplicate]

I have a dataframe in R: structure(list(chr = c(1, 1, 1, 1, 1), gene_id = c("ENSG00000223972.5", "ENSG00000227232.5", "ENSG00000278267.1", "ENSG00000243485.5", ...
rheabedi1's user avatar
0 votes
0 answers
37 views

How to split multiple columns into rows [duplicate]

How can I split columns "MyCode" and "MyAmount" into multiple rows in MySQL 8.0.33 I tried it with only 1 column, but with 2 columns I can't get it right MyID MyCode MyAmount ...
chris's user avatar
  • 1
1 vote
3 answers
53 views

SQL Split, Join & Merge [duplicate]

TableDO | DOID | TranID | | -------- | ------ | | 1 | 1 2 3 | | 2 | 2 4 | TblTransporter | TranID |Transporter | | -------- | -------- | | 1 | ABC Tran | | 2 ...
Samir Shah's user avatar
0 votes
1 answer
64 views

Applying a split function to multiple columns

I have a dataframe with some columns with special character. I want to remove those characters in the columns with one function to iterate in each column import pandas as pd import numpy as np # 40 ...
Augustine's user avatar
-4 votes
0 answers
36 views

What does * signify in this code-> print(*(s)[::-1])? [duplicate]

the code is: t=int(input()) for i in range(t): s=input().split() print(*(s)[::-1]) this is the output when * is used: world hello d c b a algorithms and structures data this is when * is not ...
manu who's user avatar
-1 votes
1 answer
38 views

Why does strip() method returns a list from a list of words?

I was trying to make a list with each char of a sentence. Given the sentence "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog" I used the .split() method to separate the words and afterwards ...
somnioperpetuum's user avatar
0 votes
0 answers
31 views

Getting a string from a second column in Lua

I'm working in a script in Lua and I have a problem. I need to look for a string in a file and get the string next to it (every line of the string has an string a coma and the second string). An ...
kehrrt Krohnt's user avatar
-1 votes
2 answers
76 views

How do I parse a string with both letters and integers into string and integer variables in VB.net?

I am reading strings from a file. Each string will have a string component followed by 2 integer components separated by a hash. String Examples: "A1-8" "AN9-16" "OUT16-24&...
UnderHill Studio's user avatar
2 votes
2 answers
88 views

Performance wise is better to use a split or a matching regex to extract subtext from a string?

I have a string like this: /good/312321312/bad/3213122131 I have to extract the two sets of digits from there. I thought about two solutions: either using the split() or simply writing a regex to ...
gutey's user avatar
  • 46
-2 votes
1 answer
37 views

How to split strings with regex like {{(all spaces)variableValue(all spaces)}}

It is necessary to split the strings according to such a regex, but I cannot compose it. Introductory line: {{ text1 }} 123 {{text1}}{{text1}} {{ text1}}134 Text in a variable: const a = text1; ...
Denis123's user avatar
0 votes
0 answers
12 views

Partition A Gridded Rectangle into a Specified Number of Similarly-Sized Smaller Rectangles

I need to completely partition a gridded rectangle of integer width w and height h into s smaller rectangles (of any shape or size) in a way that minimizes the area of the largest of these smaller ...
WreckTangles's user avatar
1 vote
3 answers
101 views

How does powershell split consecutive strings. Not a single letter

powershell string split In this picture, powerhsell has split each letter of target, but I really want the string target as a whole to be split. How do I do that? powershell PS C:\Users\Administrator&...
apython's user avatar
  • 25
3 votes
1 answer
75 views

perl split problem with repeated delimiter (comma)

I have problem with repeated delimiter (comma) String input abc : {A=[2, 2, 2], B=x, C=[1, 1, 1, 1], D=1} my code if ($_ =~ /^(\w+)\s+:\s+\{(\S+=.*)\}/) { my $attr_struct = $1; my $...
psm_2023's user avatar
0 votes
0 answers
46 views

How to split a string by multiple delimiters python [duplicate]

I need to split a string by multiple delimiters in Python. For example, I have a string 'Hello, world! abc.. What do you prefer? I like vegetables', and after splitting by delimiters '.', ',', '!' and ...
TimKostenok's user avatar

1
2 3 4 5
483