tagged [replace]

C# - Count string length and replace each character with another

C# - Count string length and replace each character with another How can I count the number of characters within a string and create another string with the same number of characters but replace all o...

24 Oct at 07:22

Alternative to multiple String.Replaces

Alternative to multiple String.Replaces My code uses `String.Replace` several times in a row: I suspect there's a better and faster way to do it. What would you suggest?

30 Mar at 15:22

Replace one character with another in Bash

Replace one character with another in Bash I need to replace a space (``) with a dot (`.`) in a string in bash. I think this would be pretty simple, but I'm new so I can't figure out how to modify a s...

30 Dec at 01:12

jQuery - replace all instances of a character in a string

jQuery - replace all instances of a character in a string This does not work and I need it badly always gets it's always replacing for the first instance only, but I need it to work for all + symbols.

26 Nov at 23:30

Java Replacing multiple different substring in a string at once (or in the most efficient way)

Java Replacing multiple different substring in a string at once (or in the most efficient way) I need to replace many different sub-string in a string in the most efficient way. is there another way o...

25 Aug at 07:57

Find and replace - Add carriage return OR Newline

Find and replace - Add carriage return OR Newline In the case of following string to be parsed. I want to replace the `~~?` with a `carriage return` Replacing with `\n` just adds the string `"\n"` How...

Replace substring with another substring C++

Replace substring with another substring C++ How could I replace a substring in a string with another substring in C++, what functions could I use?

1 Jun at 14:45

Replace single backslash with double backslash

Replace single backslash with double backslash It seems simple enough, right? Well, I don't know. Here's the code I'm trying: However, I'm receiving an error, > ArgumentException was unhandled - parsi...

14 Jul at 21:38

Replace a character at a specific index in a string?

Replace a character at a specific index in a string? I'm trying to replace a character at a specific index in a string. What I'm doing is: This gives an error. Is there any method to do this?

Removing double quotes from a string in Java

Removing double quotes from a string in Java How would I remove double quotes from a String? For example: I would expect `"abd` to produce `abd`, without the double quote. Here's the code I've tried:

2 May at 17:26

MySQL search and replace some text in a field

MySQL search and replace some text in a field What MySQL query will do a text search and replace in one particular field in a table? I.e. search for `foo` and replace with `bar` so a record with a fie...

1 Dec at 20:41

Question about preg_replace in PHP

Question about preg_replace in PHP In PHP what is the difference between using \1 or $1 as $replacement in [preg_replace](http://php.net/manual/en/function.preg-replace.php)()? They both work and seem...

13 Sep at 16:56

How do I replace all occurrences of a string in JavaScript?

How do I replace all occurrences of a string in JavaScript? Given a string: This seems to only remove the first occurrence of `abc` in the string above: How do I replace occurrences of it?

24 Jul at 23:55

Multiple regular expression interfere

Multiple regular expression interfere I use regex to create html tags in plain text. like this I'm looking for a way to not match `$user['name']` in a tag.

9 Aug at 17:15

How to replace part of string by position?

How to replace part of string by position? I have this string: `ABCDEFGHIJ` I need to replace from position 4 to position 5 with the string `ZX` It will look like this: `ABCZXFGHIJ` But not to use wit...

31 Aug at 22:21

JavaScript .replace only replaces first Match

JavaScript .replace only replaces first Match But the replace functions stop at the first instance of the " " and I get the Result: `"this%20is a test"` Any ideas on where I'm going wrong I'm sure it'...

27 Jan at 04:14

Remove all multiple spaces in Javascript and replace with single space

Remove all multiple spaces in Javascript and replace with single space How can I automatically replace all instances of multiple spaces, with a single space, in Javascript? I've tried chaining some `s...

20 May at 17:25

Regex replace multiple groups

Regex replace multiple groups I would like to use regular expressions to replace multiple groups with corresponding replacement string. Replacement table: - `"&"``"__amp"`- `"#"``"__hsh"`- `"1"``"5"`-...

9 Jun at 11:42

Remove all commas from a string in C# 3

Remove all commas from a string in C# 3 i have a string type variable like `a="a,b,c,d";`I want to remove all commas and get new value for a like `abcd`.I tried `a.Replace(",","")` but it is not worki...

1 Nov at 14:24

Notepad++ - How can I replace blank lines

Notepad++ - How can I replace blank lines I have a text file with a thousand lines of numbers like so: As you can see there is a blank line in between each number that I want to remove so that I have ...

3 Sep at 00:1

Remove specific characters from a string in Python

Remove specific characters from a string in Python I'm trying to remove specific characters from a string using Python. This is the code I'm using right now. Unfortunately it appears to do nothing to ...

30 May at 12:32

Strip Leading and Trailing Spaces From Java String

Strip Leading and Trailing Spaces From Java String Is there a convenience method to strip any leading or trailing spaces from a Java String? Something like: Result: `myString.replace(" ","")` would re...

23 Sep at 19:15

Replace spaces with dashes and make all letters lower-case

Replace spaces with dashes and make all letters lower-case I need to reformat a string using jQuery or vanilla JavaScript Let’s say we have `"Sonic Free Games"`. I want to convert it to `"sonic-free-g...

2 Mar at 13:35

How to ignore case in String.replace

How to ignore case in String.replace How to replace 'camel' in sentence with 'horse' despite of `string.Replace` doesn't support `ignoreCase` on left string?

17 May at 02:19

Simple excel find and replace for formulas

Simple excel find and replace for formulas I have numerous cells all over the place on a worksheet that look like `=((E9-E8)/E8)`. I want to use the first two values to go into this new formula, `(EXP...

21 Jun at 06:28