Most voted "split" questions
37 questions
Sort by count of
-
10
votes2
answers230
viewsWhat does the / +/g parameter mean in the . split() method?
Can anyone explain to me what the parameter means / +/g within a method .split()? var message = "-lucas o p i "; var args = message.slice(1).trim().split(/ +/g); var comando =…
-
6
votes2
answers639
viewsHow to split the dataframes of a list based on a group variable, common in all of them?
I have a list with n dataframes. They have a common variable, called group. I want to analyze the dataframes only with the groups a and c of group. My goal: to return, within the list, these…
-
6
votes2
answers796
viewsHow to separate a string by commas, except when you have a space later
I have a string and I need to separate it into one array. However, the separator character needs to be the comma (,), but if you have a space right after (", ") she is preserved in separation. I’m…
-
3
votes1
answer83
viewsCounting amount of results of a Split()
I have a string that looks like this: Yeah, No, Maybe And I have a code that I need to put these string results separately into a <option> of a <select>. I intend to do this through a…
-
3
votes2
answers311
viewsHow to use re.split() to pick only the words of a text, ignoring numbers and punctuation marks
I am given the following sentence:: texto = """ Em 2020 observamos, e catalogamos (com fotografias), os barcos que chegaram ao Porto! Até breve. """ for p in gerarPalavras(texto): print(p) I created…
-
3
votes3
answers114
viewsReading undesirable characters - Python
A way to separate words from a string provided as in the method below: entrada = input().split(" ") Doubt: If I want to exclude more than one specific character (" ,&ˆ*!!:") not necessarily in…
-
3
votes4
answers285
viewsSeparate data by values on the line?
In the lines of my dataframe I have an identifier with letters for each observation set. Some of the observations have more than one letter, in which case these observations are actions together of…
-
2
votes0
answers47
viewsUse the first part of the split
I wonder if you have how to use the split to make only one division, for example, I have the following text:: dia_24_06_18. I wanted you to separate by _ in the matrix like this: [0] - dia [1] -…
-
2
votes1
answer104
viewsFunction . split() buging the output of the string in python2, how to solve?
Hello, I’m new to Python and my question may be obvious, but I would like to better understand the workings of the string; I am facing an error of execution of a function that I created and do not…
-
2
votes1
answer69
viewsI’m trying to use the . split() in a def and I don’t know why it’s not working someone can help me?
I’m trying to build a simple raffle script using the Tkinter library. from tkinter import * def sorteio(): from random import choice nomes = (ed1.get) splitn = nomes.split(" ") sort = choice(splitn)…
-
2
votes3
answers1489
views -
2
votes1
answer145
viewsHow to transform an array with strings(list) into an integer array in Python?
I’m new to python programming. I came across today the challenge of picking up a vector (ex:V1== ['MESA 11 22 33 44 ']) in which all its elements are in string format (as if they were one, only…
-
2
votes2
answers63
viewsHow to use split() inside a Java loop?
Good evening, I have been learning Java for a while and wanted to know how I could read a text file that has one or two numbers in a maximum of 10 lines. Something like the files below:…
-
1
votes1
answer60
viewsHow to add a character in a string, which is already divided, to each N characters?
I need to know how to separate, in line breaks, a string each N characters. However, before separating each N characters, they have already been separated by each comma. I want that in the output…
-
1
votes1
answer88
viewssplit does not return array with the string elements
I’m having trouble using the method split, that is not returning me the array with the elements of the string. public class Teste{ public static void main (String[] args){ String s = "0.101110";…
-
1
votes1
answer168
viewsString Split in C++
Folks I’m looking for a split on the following String in C++ [ { "Nome":"Gabriel", "idade": 23 } ] I’m doing it this way... I receive this json through a query get and storing in a string to power…
-
1
votes1
answer178
viewsString tools in ruby
Suppose the following string: "acc5???7???7ss?3rr1???5". How to check if the three question marks exist (exactly three) and if they are before or after numbers that add up to more than 10? I thought…
-
1
votes1
answer812
viewsIs it possible to have a split() with two or more conditions in Python?
Good afternoon staff, developing a code, I came across a question: I would like to realize a split() with n conditions? Or any efficient way to do? For example: I am requesting for a user to enter…
-
1
votes2
answers622
viewsHow to Split Javascript using multiple tabs and without removing them?
I have the following Javascript code: if (v.includes("'!'")) var separators = ["\\\''", '\\\&', '\\\#', '\\\|']; else var separators = ["\\\''", '\\\'', '\\\&', '\\\#', '\\\|']; var…
-
1
votes2
answers104
viewsInsert text into its proper cells - Python
Hello, my friends I am developing the code so that I can clean and organize the data (as shown above) and one of the best ways was to insert the data into a file CSV so that later I could return it…
-
1
votes1
answer99
viewsJava: separate row into columns by character position
Hello, I turned the internet upside down trying to solve this problem. I have a text that in this format: 012016010402AAPL34 010APPLE DRN R$…
-
0
votes1
answer117
viewsHow to convert a Jsonarray to a Strings array?
String mensao = "[\"brega_falcao\",\"SamiPietikainen\",\"TecRahul\",\"gpantuza\",\"mkyong\",\"mkyong\",\"YouTube\"]"; Mensao is the Jsonarray I want to convert. I tried that but it didn’t work:…
-
0
votes0
answers78
viewsHow to make a space split?
I have this text: "resultados 2018 295 1 br" How do I separate by space and put in strings? example: string ano = argumento[0]; // iria ser 2018 string ano = argumento[1]; // iria ser 295 string ano…
-
0
votes1
answer153
viewsWhat is the split method in Ionic for?
Well, I’m developing an app with Ionic 3, and I hear about a method called split, but I never understood its functionality. I just understood that it is related to arrays. Faced with this : What is…
-
0
votes2
answers1297
viewsWhat is the difference between string.split(',') and string.rsplit(',') in python?
Using these lines in the python terminal, I couldn’t find any difference between them. I searched but found nothing about, at least in Portuguese. What would be the difference between them ? x =…
-
0
votes2
answers3879
viewsHow to separate the year from a date with Python and Pandas?
I have a student database with a Ticket Date column in the dd/mm/aa format. I need to generate an Ano_ticket column only with the year of the date of each record. import pandas as pd df =…
-
0
votes1
answer181
viewsUse the split() and if method to create a statement that prints the words that start with’s'
I have the following string: string_1 = 'Print only the words that start with s in this sentence' and I need to use the split method and an if to output only the words started in s. But I have no…
-
0
votes2
answers2416
viewsHow to get the first word of a text in Python?
frase = str("Eu como abacaxi").split() How do I show only the first word of the phrase ("I" in case)?
-
0
votes0
answers37
viewsReturn the length of the sequence
I got a problem I can’t fix: Given a string "aeiaaioooau", identify existing sequences and count your elements with PHP. A sequence would be a,e,i,o and u ... Example: $s = "aeiaaioooau" "aei" is…
-
0
votes1
answer47
views -
0
votes0
answers162
viewsWhat is the input(). split(" ") for in python?
I’m solving some exercises in python and when I put the code this way: A = float(input("")) B = float(input("")) C = float(input("")) triangulo = float((A*C)/2) circulo = float(3.14159*(C**2))…
-
-1
votes2
answers812
viewsAbbreviate names with javascript
Hello I am wanting to write a function to reduce names by passing a limit, for example: limit 10 to the name: Sara Flávia Cristina to Sara F. C. I wrote the code below, but I wonder if there’s a…
-
-1
votes1
answer52
viewsBreak a list and create lists
hello! I have the following list in python of numbers: ['1','2','1','2','3','4','1','2','3','4','5','6','7','1','2','3','4','5','6','7'] And I want to break that list and create other lists in such…
-
-1
votes1
answer75
viewsHow do I take a specific part of a string in GOLANG
I am developing a software and among its features I would like to separate a specific part of a string My code is like this so far baseURL := "https://google.com/" body, _ :=…
-
-1
votes2
answers35
viewsHow to export [[ ]] from a list in separate excel files using R?
I play here part of a dataframe I’m working on: producao<-data.frame( discente = c("ANA", "ANA", "ANA", "ANA", "ANA", "MIGUEL", "MIGUEL", "MIGUEL", "MIGUEL", "MIGUEL", "JAIME", "JAIME", "JAIME",…
-
-1
votes0
answers10
viewsHow to write a new pdf every 4 pages of the main pdf c# Winforms
I have a pdf document with more than 1000 pages and want to separate it into different pdfs every 4 pages, how can I do this? public string ReadPdfFileForTreatment2(string fileName) { StringBuilder…
-
-2
votes2
answers77
viewsSplit columns without Pandas tab
Is there any pandas method for splitting columns without separator? would be a kind of excel ext.text. I have a base with a 20-character column, but I only need the interval between 11 and 14. ex.…