Most voted "replace" questions
Replace is the action of searching for a sub-string in a string and replacing it with a different sub-string. Use this tag for questions about replacing some value with another.
Learn more…94 questions
Sort by count of
-
13
votes3
answers1511
viewsHow can I replace a part of a string by itself plus the "~" character?
How can I replace a part of a string by itself plus the character "~"? I’m doing it this way: only when the string has two equal numbers as the 51 that comes just after AP and the contained in the…
-
9
votes4
answers150
viewsWhat regular expression to use to replace symbols in a string?
I got a string, just like "1x2,4÷4" and I want to replace the x for *; to , for . and the ÷ for / using the replace javascript. Which regular expression I would need to use to make this replacement?…
-
5
votes2
answers252
views -
5
votes1
answer1874
viewsHow to collect data from a web page?
Web data collection, or Web Scraping, is a form of mining that allows the extraction of data from web sites by converting them into structured information for further analysis. Present here your…
-
5
votes4
answers130
viewsString Manipulation in Javascript?
I have the following code var wcalcAlm = ('0140') alert(wcalcAlm) //retorno esperado ('01:40') I need that after the 2 position of the variable wcalcAlm be included :, thus having the following…
-
5
votes2
answers156
viewsWhat is the correct way to do an Replace in a string-like variable?
I need to create a folder on the file server and realized that the variable that receives one of the information is coming with invalid characters ( / : * ? " < > |) for creating a folder on…
-
4
votes1
answer341
viewsCheck if String has '+' character
I need to search in a string if it has the + character, like this: teste = teste.replaceAll("+", "e"); but I return this error: java.util.regex.Patternssyntaxexception: Dangling meta Character '+'…
-
4
votes3
answers10837
viewsReplace is not a Function
I created a script to insert a div in my store cart, but it is giving error in the replace function. Would anyone know why ? var $JQuery = jQuery.noConflict(); $JQuery(function(){ var…
-
4
votes1
answer247
viewsUsing replace in a character in the middle of a String to add text before and after the String
I have this expression stored in a String: 1 * Math.pow(x, 3.0) + 4 * Math.pow(x, 2.0) + 1 * Math.pow(x, 1.0) + 27 However, I use a derivation library that only accepts the character ^ to make…
-
3
votes1
answer89
viewsHow to encrypt multiple variables within a php file?
I’m using php to read a file to a $string, he owns some words variables that I need to find and replace with others, that is, I need to get these variables, encrypt them with AES and write again…
-
3
votes1
answer1340
viewsRemove Accents - [ p{Incombiningdiacriticalmarks}] vs [ p{ASCII}]
I created a code in Java to remove accents as the following: private String removerAcentos(String texto) { texto = Normalizer.normalize(texto, Normalizer.Form.NFD); texto =…
-
3
votes2
answers1580
viewsConvert utf-8 codes to Unicode
Well, I have a file JSON where all the symbols Unicode as this " " are in this format: "u2605" has some way to convert these codes to the symbols when my program Nodejs read the JSON? Example of how…
-
3
votes2
answers754
viewsMethod that uses a random value as parameter to swap the characters of a string
I have this code that’s working perfectly, but I need random values to appear instead of the X. I want the returned result to be composed of random letters and the position of upper and lower case…
-
3
votes1
answer142
viewsJS replaces all characters equal
I’m trying to use the replace function to turn a letter to 0, but it doesn’t work when I want to test the letter inside a var. var palavra = "abelha"; var letra = 'A'; palavra =…
-
3
votes2
answers1288
viewsReplace last occurrence of "a" in a string
How do I replace the last occurrence of a in a string? var myFrase = prompt(" Digite sua frase aqui: "); for (i = 0; i < myFrase.length; i++) { result = myFrase.charAt(i); if (result == "a") {…
-
3
votes2
answers91
viewsreplace more than one char utitlizando . replace()
I have the following function: public String replaceCharToNull(int row, int colum) { String result; result = (((String)jTableLoan.getModel().getValueAt(row, colum)).replace("x", "")); return result;…
-
3
votes1
answer72
viewsRegex how to separate by groups each occurrence
I’m trying to add attributes to a tag tag <a> from a parse of Markdown (markdown => html). In my document markdown i add parentheses and the markup I want right after declaring the links,…
-
2
votes1
answer376
viewsAdd character in a <input>
The person types her height (which always has three digits). I want you to autocomplete, example:- The person type-200 And the software convert to- 2.00
-
2
votes1
answer157
viewsHow do I remove everything after the first word?
How to remove everything after the first word on each line in a text file containing the character pipe? It works for removing simple/common characters, but has not worked to remove the character |…
-
2
votes1
answer596
viewsBrowse all properties of a Vuejs object
I am using Vuejs in a project and need to go through all the properties of the object associated with v-model. I know that if it was an array I could use u for, foreach, map and many other means of…
-
2
votes1
answer5206
viewsRemove simple javascript quotes
I need to remove simple quotes from a string, I’ve tried string.replace(/\'/g, ''), .replace(/"'"/g, '') and it doesn’t work, someone can help me?
-
2
votes1
answer550
viewsReplace one symbol with another in PHP
I’m looking to replace all the signs of + for vírgula with PHP. I’m doing it this way: $q = $_GET['q']; $string = str_replace("+",",","$q"); This is removing the signal from +, but it gives me an…
-
2
votes1
answer95
viewsHow to remove keywords between { } keys in the Mysql field?
I have a table that contains a field with some values between keys, how do I delete the chaves and the valores that are within them? Example: cod | Movimento | 01 | Prazos {aguardando} | Prazos…
-
2
votes3
answers304
viewsWhere is the error in replace js?
t = "(10px,10px)" t = t.replace(/-|\d+/g,3,5) I wanted it to result in (3px,5px) Where is the error?
-
2
votes1
answer412
viewsHow to replace string using another string containing Json?
Is there any way to replace a String with the fields of another string that contains a Json? Example; I got the string; String template = "Olá [Nome], Tenha um bom dia ... hoje é [Data] e é seu…
-
2
votes2
answers109
viewsFind and Replace in bash
I need to find outdated lines in a csv file and replace them with new lines. These are the commands that find the lines that will be replaced(old) and that will replace(new). linhas_antigas=$(diff…
-
2
votes2
answers301
viewsDoubt to use Replace together with Inner Join
I’m using the Inner Join to combine two tables: SELECT eventos.colab_id, colaboradores.setor FROM colaboradores INNER JOIN eventos ON colaboradores.id = eventos.colab_id So far so good, however I…
-
2
votes2
answers57
viewsChanging fields separator for a Macaddress
I would like to implement an event that fixes data that is outside the standard, replacing the tab with : and put the letters in lower case. For example, the user type 00-25-66-F0-21-11, would be…
-
2
votes1
answer172
viewsLoop Replace all string characters by python list character
What I want to do is take a string and for each character of the string walk type 3 positions back in the alphabet and replace in the string or create a new string Ex string = 'abcd' walking 3…
-
2
votes1
answer63
viewsRemove tags generated at the end of a string from a Text Editor
I am using a text editor and like others I have used, it always generates some useless tags that I would like to remove. I can remove the last, but sometimes it generates more than once. My code:…
-
2
votes0
answers705
viewsHow to replace single quotes with double quotes in python?
I used the function replace to replace single quotes from a field in csv with double quotes, but in output the value comes out with escape character , it is this character remains when clicking to…
-
2
votes2
answers1166
viewsSwap a dot for a comma and add a dot
How do I add the comma to the decimal place and the dot to the thousands. Example: $pagamento = R$ 1000.50; /* trecho a fazer a operação */ echo $pagamento; //saída: "R$ 1.000,50"…
-
2
votes2
answers867
viewsReplace string with regex in python 3
I have a code that replaces certain string with whitespace dados =…
-
2
votes1
answer705
viewsHow to remove blanks
I have a list and need to remove blanks. I am using replace, but does not take the space from the beginning of the string after the minus sign, only from the end. This space is not a character?…
-
2
votes1
answer62
viewsRemoving Symbols in Python dataframe columns
Made a web scraping in Python , so far ok, only that generated a table with ( ) and [ ], n, -, wanted a function code in python to use to clean the dataframe of the figure below, can be column by…
replaceasked 3 years, 10 months ago M Data Science 23 -
1
votes1
answer386
viewsReplace is not working C#
I’m replacing one code with another in each row that the code is found on. But replace simply doesn’t work, goes through it and the line continues the same way. As you can see in the image below, if…
-
1
votes1
answer202
viewssearch and replace string javascript
I have the following syntax: var json_pessoa = JSON.stringify(json_pessoa["pessoa"]); // o valor do json_pessoa é "{"razao_social":"asd","nome_fantasia":"asd","rg_insc_estadual":"asd"}" , ele já é…
-
1
votes2
answers990
viewsRemove data from within a String
In java I am reading several lines of an HTML file and in it I have to remove some data and store in variables. And to remove this data I have to remove some tags and data that are within certain…
-
1
votes0
answers252
viewsHow to make multiple mask Replaces per table field with T-SQL
I am performing some texts (Mask) Replaces from a field of a temporary table. I am substituting where there is the text searched for a field of other tables. Example: SELECT TOP 1000 * INTO…
-
1
votes1
answer1680
viewsReplace com does not work
I’m trying to make a Replace() but it doesn’t work. I need to change \ for \\. "\r\n".Replace(@"\", "\\"); he just returns me : "\r\n" and not "\\r\\n".…
-
1
votes2
answers1406
viewsSQL Server - Changing information in a text field (REPLACE does not work)
Hello guys. I have a table with a TEXT field. I need to change information within this text field only that I am not getting. The REPLACE function works in a varchar field, but does not work within…
-
1
votes1
answer2080
viewsHow to change line in text file in C#?
Currently I inform in variable stringantiga the exact value to find and replace it. Is there any way to substitute for the line number instead of the exact value of stringantiga? string arquivo =…
-
1
votes2
answers10008
viewshow to remove n from a python string
I’m trying to delete control sequences (\n, \t, \u) of strings in Python and I can’t even with replace, nor with re.sub(). How could I do? I tried, and they didn’t work : p = re.sub('\n', '', p)…
-
1
votes2
answers630
viewsRegex or Replace in Jquery
How to make a string change by adding new content? Example: <div><span id="number">1195555666<span><div> <script>var newNumber =…
-
1
votes2
answers3207
viewsReplace specific column values with NA
I would like to detect and replace values above 6 in just a few columns of a data.frame by NA. I made the syntax like this, but it is giving error... Could someone give me a hand? Thank you! data…
-
1
votes1
answer1776
viewsC# - Remove QUOTES - Replace - Remove ASP Doubles
I have a variable (TEXT) that is a string, where its value is: "22/06/2018 00:00:00" How to make an Replace by removing its quotes?
-
1
votes4
answers103
viewsHow to avoid value repeats in this code?
I made the function below that removes accents from a string using values from an object: function remAcentos(p){ var acc = { // ↓ ↓ ↓ ↓ ↓ 'á': 'a', 'â': 'a', 'à': 'a', 'ã': 'a', 'â': 'a', // ↓ ↓…
-
1
votes2
answers47
viewsProblem when replacing strings
Hi, I’m starting to create an equation interpreter, I want to replace the operators with words, but things aren’t going well... main.cpp #include <string> #include <iostream> #include…
-
1
votes0
answers62
viewsHow do I do direct treatment on the Laravel model as much set as get?
I am working on a database already populated and I need to do the replacement of , for . and of / for - without having to use the frontend only in the model.…
-
1
votes2
answers211
viewsInsert problems in Asp classico (replace)
Guys, in my database, the column is set to numeric (18,2) then I have a field in a form that the person type the value and it goes to my table. the insert is like this: entrada =…