24,566 questions
Best practices
0
votes
7
replies
106
views
SPLIT without implicit conversion
I am experiencing problems with this section of my formula
=LET(
args; MAP(SPLIT("11/11"&CHAR(10)&CHAR(10)&"1"
; CHAR(10)&CHAR(10)); LAMBDA(v; TO_TEXT(v)))...
0
votes
1
answer
125
views
What's the idiomatic/correct way to split a string into its first word and the rest of the string? [closed]
tl;dr
Ideally, I'd want the following
"hello world" is split in "hello" and " world"
" world" is split in "" and " world"
"hello "...
0
votes
2
answers
184
views
Split a string into an array but ignoring blank lines [duplicate]
I'm trying to get a relatively simple regex working the way I want it to. I'm trying to split a string into an array but ignoring blank lines.
Here's what I've got so far
const regExp = /\s*(?:\n|$)\s*...
0
votes
0
answers
51
views
How to split one row with column = "A, B" into two rows with "A" and "B"
I have a table where the values are written this way in one single row:
A, B
I want "A, B" to be split into two different rows, along with the other fields of the table.
For example:
I need ...
0
votes
4
answers
207
views
Split function with if statement to define string value (excel vba)
My vba excel code is using split funtion from a combo box value. It takes an ID (alias=GG) which is a value right of the 6th hyphen.
GG = Split(Sheet1.ComboBox1.Value, "-")(6)
example return ...
2
votes
4
answers
194
views
Regex to split on %[A..Za..z]
I am attempting to tokenize clock format strings from TCL in C# program using Regex.Split(). For example
%A %B %d %Y or %A_%B sometext %d_%Y
I tried a regex split on @"(%[a..zA..z]) but it ...
-3
votes
1
answer
210
views
Splitting file content using C++20 ranges [closed]
I'm trying to iterate through a text file's lines using ranges:
auto iter_lines(std::ifstream& file)
{
auto lines = std::ranges::istream_view<char>(file) |
std::views::lazy_split(...
1
vote
1
answer
75
views
Google Sheets, Trim function not removing leading space
I've managed to split the values in a multiple-choice data validation cell into a single column using this formula in Google sheets:
=ARRAYFORMULA(
QUERY(
SPLIT(
FLATTEN(
...
1
vote
1
answer
178
views
`-split` of an empty string results in an array with one element which is an empty string
Calling -split on an empty string results in an array with one element which is an empty string. I expect it to return a zero-length array or a $Null which is not an array.
What am I doing wrong?
# ...
1
vote
2
answers
165
views
Splitting text by new line: "NameError: name 'split' is not defined" [duplicate]
I have code to get an entry value and read it line by line. I decided to use split, but it's not working!
Here is the code:
def send_to_all():
userraw = userentry.get(1.0, tk.END)
sendmsg = ...
0
votes
0
answers
118
views
Splitting Spool by pages and download in ABAP
My customer has the request, that a spool with for example 10 Pages need to be downloaded by separated pages.
Let´s say, that the Spool has 10 pages and at every two pages I need to split the Spool ...
8
votes
8
answers
998
views
How can I split a vector of numbers into its digits when vector values differ in length?
I'm having trouble with the following in R using dplyr and separate. I have a dataframe like this:
x<-c(1,2,12,31,123,2341)
df<-data.frame(x)
and I'd like to split each digit into its ...
9
votes
1
answer
152
views
How to remove character differences from multiple strings [duplicate]
Let's say I have a bunch of product strings that could vary slightly in format, e.g.:
Super red Megaman T-shirt
Super Megaman blue T-shirt
Super black Megaman T-shirt
Super Megaman T-shirt - ...
-6
votes
2
answers
118
views
Reverse order of split string parts [closed]
My simple Oracle SQL select statement:
select id, my_column
from my_table;
returns the following output with over 1.000.000 rows in the result set:
| id | my_column |
| 1 | abc.mno.xyz |
| 2 | ...
-4
votes
3
answers
132
views
Get string between two delimiters
I have a string like
s = "<foo> <bar ... <baz.ind>
and I need only the contents of the last <...>. In the above case it should be only baz.ind.
The below code prints not ...
0
votes
1
answer
60
views
Stratefied vs Random Splitting on highly categotical datasets [closed]
I am working on a machine learning model on a survey dataset with highly categorical dataset, each feature (12 features) has been bucketized very sensitively depending on the results and domain ...
2
votes
3
answers
80
views
PowerShell Split String After X Segments
Trying to get a substring out of a larger string from an Azure Subnet. The vnet resource id is identical to the subnet resource id minus the last 2 segments. User inputs the resource id of the subnet, ...
3
votes
2
answers
144
views
Splitting a mathematical string into a list while keeping everything in matching brackets together
I am trying to get any mathematical string to split into a list by operators (i.e. "+", "-", "/", "*"), while keeping anything in a matching number of brackets ...
0
votes
0
answers
34
views
Why does Python use different syntax for split() and join()? [duplicate]
In Python, when we use split(), the syntax looks like this:
list_result = string.split(separator)
But when we use join(), it's written like this:
string_result = separator.join(list_of_strings)
Why is ...
1
vote
1
answer
54
views
Using split on a column for subset of rows
I'm trying to selectively parse rows based on a condition:
df = pd.DataFrame({"a":["z|v", "b|3", "z|x", "dfe|5", "xs|2"]})
df['x']="&...
15
votes
7
answers
1k
views
Split all columns in half by character position
My dataframe has a bunch of columns, each with six characters. Like this:
df = data.frame("A" = c("001000","101010","131313"),"B" = c("121212&...
1
vote
4
answers
144
views
How can I split a string in characters or short html elements in javascript [closed]
I would like to split a string containing HTML snippets in characters and the elements.
let str = 'wel<span class="t">come</span> to all'
console.log("split attempt " +...
1
vote
0
answers
54
views
Iteratively name elements in an array in Pyspark
In Pyspark I create an array from a string with split function.
For example:
old_df.long_string = "this is ** a very long ** string with a lot ** of words in it"
new_df.withColumn("...
0
votes
2
answers
74
views
Split string to join to table and rejoin
I have data in a database that I cannot change which is stored like this:
DocId
Staff/Relationship
127866
1395/3003,1399/1388
where:
1395/3003 = Cat Stevens/Therapist
and
1399/1388 = Dog Stevens/...
0
votes
0
answers
43
views
Can I use the String.Split() method overloads while splitting at white-space characters without having to specify the white-space characters? [duplicate]
I'm trying to split a string into an array of strings. I want to split at every at white-space character and also use StringSplitOptions to remove and trim the empty entries.
Is it somehow possible to ...
11
votes
7
answers
1k
views
Reformat numbers, inserting separators at fixed positions
There are many lines in a file, like the following:
000100667 ===> 000102833
005843000 ===> 005844000
011248375 ===> 011251958
I would like to insert specific separators into the numbers ...
1
vote
1
answer
177
views
I Split a string into an array. The first element is blank/null/empty if the String starts with "BLAK"
I've been coding VBA for 20 years and this has me stumped. I'm testing the code below. If I step through it:
Sub TestSplitting_1()
Dim sColors As String
Dim aColors() As String
Dim sColor As Variant
...
-5
votes
2
answers
89
views
Is there a more efficient way to extract links from an array of strings?
I run (Real Estate RETS) queries that will only return objects. The contents of these objects appear to be strings that contain different types of information about sets of images (ie. several ...
0
votes
1
answer
64
views
Can't set value of a split list in Python
I'm having trouble setting a list at a certain index to a specified value. For example:
healths[index].split(",")[anotherIndex] = 0
This code runs but doesn't change the value. The reason I'...
0
votes
1
answer
62
views
R how to recreate new columns based on an if statement [duplicate]
I have a long column that contains the results of selected items separated by commas within the same cell. I want to create new columns based on conditions.
example
favorite_fruits <- c("...
4
votes
6
answers
176
views
How to split a string into chunks of 2, but make the last chunk 3 if it would be 1
I have a series of strings of numbers of different lengths that I need to split into chunks of 2 characters. The last chunk should be 3 characters long, if it would be 1 character long.
For example, ...
0
votes
0
answers
52
views
Bigquery : How to Split a Sequence into Sub-Paths by Breaking at Specific Delimiter Values
I am working on breaking a path sequence into smaller sub-paths, dividing the sequence whenever a specific step (e.g., "CC step") occurs.
While I’ve already evaluated a solution proposed by ...
3
votes
2
answers
55
views
Stratified sample split
I am working with data from 174 subjects, stored in a dataframe (df_behavioral) where one row represents one subject. Some subjects are related to one another, as indicated by a variable called '...
0
votes
1
answer
98
views
Split the string so that special characters remain in the previous word
I'm trying to solve a problem to split a string into words, but keeping the delimeter near the previous word. I think it will be clearer with examples
'Company Name: Back in future' -> ['Company', '...
1
vote
1
answer
121
views
How to filter elements from an array made by spliting a string? [duplicate]
When I do ($env:path).split(";"), there are many elements containing the string bin. I want to have a list of them. I try:
($env:path).split(";") | Where-Object {$_ -contains "...
-1
votes
4
answers
101
views
Python: using split() to split a string at 2 separate points
I have a string that I need to split at 2 separate parts, but all I find is how to split the string using identifiers like "," and other punctuation.
string = "<p>The brown dog ...
0
votes
0
answers
42
views
Python Folders Splitter to Files Splitter
Based on this great piece of code: GitHub Splitter.py
I would like to work on files and not on folders.
The code is so short:
#gadgetmiser's idempotent splitter
import os
from shutil import move
wd =...
-2
votes
2
answers
91
views
Excel TextSplit a range and COUNTIF - with wildcards [closed]
My question builds on this previous post: Excel TextSplit a range and countif
I have a very similar use case, except that the values I'm trying to match may have numbers at the end, like A1, A2, CR3, ...
2
votes
6
answers
155
views
Create nested lists based on split of characters
I have a list made by strings, correctly cleaned (split(',') can be safely used), and correctly sorted depending on numbers. As a small example:
l = ['C1', 'C1,C2', 'C2,C3', 'C3,C4', 'C4', 'C5', 'C5,...
-1
votes
1
answer
131
views
Why is my column split not working correctly?
Why is my python3 code to split column 4 at the bases of "," to the column 7, 8, 9 with condition if the column 5 value is "LUB" not working?
source data:
20240801 CASH MAN1 ...
3
votes
5
answers
133
views
Splitting one column to three columns for uneven characters in r
I have tried to split a single column to three columns. But I failed.
I have the following data set
> dat
name
Jhon Austin B 100kg
Mick Gray C 110kg
Tom Jef A 30kg
First I tried to extract ...
0
votes
3
answers
125
views
Break list into sub-lists at indices in R
I have a list lst of objects, say
[1,2,3,4,5,6,7,8,9]
and I want to break the list into a list() of sublists, divided by the appearance of every item in items say [3,6,9] so that I get
list(3:[1,2,3],...
-2
votes
2
answers
75
views
How to split string to substrings wrapped by brackets? [closed]
I have a string like this
[abc][def]
I've implemented following code to parse it:
val matches: MutableList<String> = mutableListOf()
val str = "[abc][def]"
val matcher = Pattern....
0
votes
1
answer
63
views
$String.split(",") not producing $null (or something useful to be used with a foreach loop), when no ,'s are present
Take for example:
$String = "this is a test"
$SeperatedStrings = $String.split(",")
foreach($String in $SeperatedStrings)
{
write-host "`"$String`""
}
**...
-1
votes
1
answer
61
views
How do I split an OBJ file into three parts using blender 2.90
I have an object that I want to split into 3 segments and save into individual obj files. The object is placed in the center and the x-y plane. I want to cut them along the y-axis. I have attached a ...
2
votes
2
answers
88
views
Splitting string into two parts with digits occurring in both parts
I have a sample string like 3425%4368, % in the string devide it into two parts, I want to find all digitals in the first part that has occurrence in the second part.
you can see, 3 and 4 in the first ...
0
votes
3
answers
84
views
Python split() function :: Need to split "int_32\n' " so that I get int_32 alone [duplicate]
Need to split "int_32\n' " so that I get int_32 alone.
I tried
x = "int_32\n' "
x.split("\n")
I also tried
x = "int_32\n' "
x.splitlines()
Both do not yield ...
3
votes
2
answers
70
views
Split a string with key-value pairs if underscore in key
I've a string that has key value pairs with _ as their delimiter. The Problem is, there can be underscores within keys too.
What regex can I use to split these into key value pairs?
Intput:
C_OPS_CITY=...
0
votes
2
answers
71
views
How to split a dataset in train, validation and test based on the value of another column
Given a dataset of the form:
date user f1 f2 rank rank_group counts
0 09/09/2021 USER100 59.0 3599.9 1 1.0 3
1 10/09/2021 USER100 75.29 80790....
1
vote
1
answer
94
views
How do I desctructively iterate over an array of strings in rust?
MRE:
let mut ws = s.split_whitespace();
for w in ws {
if w == "option1" { //do something }
else if w == "option2" { //do something else }...
// this is the tricky part
...