Most voted "substring" questions
30 questions
Sort by count of
-
18
votes5
answers1237
viewsWhat is the difference between substr and substring?
I want to know the difference between alert("abc".substr(0,2)); and alert("abc".substring(0,2)); Both appear to produce "ab".
-
5
votes2
answers487
viewsString Sweep in Search of Substrings Ignoring Accent and Case and For Each Match Perform an Action
I need to search in a string a specific substring and for each occurrence found, I must execute an action to replace what was written by the version in bold, as it appears in the list, ignoring…
-
3
votes2
answers293
viewsReplace string chunk between 2 indexes
I have a long string inside a txt file, for example, let’s say my string is about that: strg = '123456 BANANA 00 SP' In position 14 and 15 we have the "00", I’m gonna need to replace up front The…
-
2
votes4
answers124
viewsInsert Parentheses between an acronym in the input field
Good afternoon guys, I’m having a little trouble inserting parentheses between acronyms of a field that I created. Follow my code: function maiusculo(){ var quadro =…
-
2
votes2
answers186
viewsUnexpected output when printing substring
I’m doing a file search in a given directory and printing its respective path. find ./ -exec sh -c "echo $(dirname "{}")" \; Output: ./algo/desse/tipo Since in some cases this path is a little big,…
-
2
votes2
answers71
viewsHow to extract substring in string array with Javascript using match?
I have to manipulate a data in the following format: ["nome <email desse nome>"], an array with several strings in the same format. I want to extract in another array only the emails, without…
-
2
votes1
answer37
viewsSubstring does not return empty string
I have the following text file called fullResponse <Sum> [stat]player_ammo_restored = 3447 <Sum> [stat]player_climb_assists = 2102 <Sum> [stat]player_climb_coops = 2612 <Sum>…
-
1
votes2
answers91
viewsHelp with String algorithm
I need to make a program in which the user types a string and a subletter, and inform how often this subletter occurs in the main string. Ex: Main chain: "banana" Subdivision: "na" Repetitions: 2.…
-
1
votes2
answers140
viewsSubstring program
I have a C program that displays all substrings of a string: #include <stdio.h> #include <stdlib.h> #include <string.h> typedef char string[100]; void substrings(string str) { if…
-
1
votes2
answers96
viewsUse of substring for each type of situation
I own a variable with the following information. var dataEvento = "SEXTA-FEIRA 25 JAN 20H00"; I need to create 3 variables different, one variable for 25(Day), JAN(Month) and 20H00(Opening hours).So…
-
1
votes1
answer131
viewsFind substring in recent commits messages
I’m looking for a substring in the most recent commits from my repository. I use the command git log -n1 --grep='${subString}'. But using the flag -nI’m just gonna get the last commit, which is…
-
0
votes3
answers9910
viewsRemove first and last character from a string
I need to remove the first and last character from a variable String, tried to use substring for this, but is giving the following error: String index out of range And I’m not finding a way to do…
-
0
votes1
answer97
viewsHow to remove, insert, or change a single character in a field in Mysql?
I have the following table in Mysql: Id | comida | preco 1 | batata | 325 2 | carne | 3.10 3 | speculoos | 3.00 I wish I could change the points according to the needs below: If the food = potato,…
-
0
votes2
answers970
viewsSQL SERVER - Substring
Good morning Sirs I would like to know how to select a value within a table where it starts with a certain value For example : Campoemail [email protected] [email protected]…
-
0
votes0
answers105
viewsHow do I scan a string and bring different parts of it?
Using REGEX it is possible to "concatenate" masks to bring different parts of the same string? How do I scan a string and bring different parts of it? I have a text field with the following…
-
0
votes1
answer22
viewsindex has to refer to a coordinate of a string
My code gives error on this EXACT line, I have already remade whole and even then gives the same error. it is a hangman game: vLetraA = vLetraA.Substring(x, 1); complete code: using System; using…
substringasked 5 years, 11 months ago Felipe Silva 1 -
0
votes1
answer456
viewsApply a regex to the result of a select
I am making a query to get all the projects that are being executed: SELECT p.id FROM projetos p WHERE p.status LIKE 'Execução' An example of the result: COD00012347 COD00012348 COD01212349…
-
0
votes1
answer909
viewsError returns Uncaught Typeerror: Cannot read Property 'substring' of null by clicking the button
I went to try to ride a script to verify the status in which the CPF was issued. However, I am unable to use the substring, it returns me the following error: Uncaught Typeerror: Cannot read…
-
0
votes1
answer136
viewsExtract part of text in a variable
I am creating a script to backup some directories via powershell, but for a certain directory, I want to access a file, read a line and return a string with part of the line. XPTO file has the…
-
0
votes3
answers69
viewsHow to ignore other occurrences like this when capturing a snippet of a string?
I need to get just the ID of this line: "21 Julio André 21 Years" Since the ID is at the beginning of the line and is equal to age, the functions I tried to split the strings were Substring() and…
-
0
votes2
answers90
viewsPrintf() showing strange characters
The purpose of the code is to show all substrings of the variable firstString that has the same size as the second string that is the variable secondString. However, when I use the printf("%s\n",…
-
-1
votes3
answers2058
viewsAlways pick the last three characters without knowing the size of the string
I want to get the last three characters of a String. Example: String x = "OlaMundo" Exit: ndo I can even do it using substring, the problem is I don’t know the size of the String, I don’t know what…
-
-1
votes1
answer139
viewsJava: Problem with Substring
I created a program to translate musical notes from a site to a more readable format, it receives and analyzes every two digits of a string looking for them (as key) within a hashmap, if found, the…
-
-1
votes2
answers64
viewsIndex('+') works but Index('*') is not working?
The following code is a simple calculator that accepts two numbers and applies +, *, - or /. and the input of the signal + is working well: input = Console.ReadLine(); while (input.Contains("+")) {…
-
-1
votes1
answer97
viewsHow to remove the string from a given range
Hello, Guys, I’m recalling programming (c++) and I took a little project to make one of a program that reads barcodes, records in a vector. Within each code read between characters 24 and 33, has a…
-
-1
votes1
answer62
viewsDivide bibliographic references into columns in R
I am with df which contains several bibliographic references. My intention is to divide these references into the following columns: "Author", "Title", "Periodico", "Data of the Periodico" (volume,…
-
-2
votes1
answer61
viewsGet pathlib file name only
I currently have the following code: from pathlib import Path for file in Path("resources/maps").glob("*.json"): print(file) Which returns: resources\maps\map1.json resources\maps\map2.json…
-
-2
votes1
answer30
viewsFilter list by keyword array
The idea is to make a filter. I have a text field that the user types what they want to filter, so I store the typed words in an array. Ex.: The user typed in the "config company" field, the array…
-
-2
votes1
answer85
viewsException error in thread "main" java.lang.Numberformatexception: For input string:
I’m having trouble getting my program to return the IF in a correct way, when I put the FOR it counts the number of times it is in the variable, if I type an input less than 14 it instead of falling…
-
-5
votes1
answer237
viewsSubstring after character C#
Good Afternoon string nr = ABC:1 I’d like to take the number after ":" as I would? nr = nr.substring(...); Expected result: for nr = ABC:50 nr = 50; for nr = LKfasEWF:5039 nr = 5039…