replace

What would be the fastest way to remove Newlines from a String in C#?

Hi community, I have a string that has some Environment.Newline in it. I'd like to strip those from the string and instead, replace the Newline with something like a comma. What would be, in your opinion, the best way to do this using C#.NET 2.0? Thanks in advance. ...

How can I replace newline characters using JSP and JSTL?

I have a list of bean objects passed into my JSP page, and one of them is a comment field. This field may contain newlines, and I want to replace them with semicolons using JSTL, so that the field can be displayed in a text input. I have found one solution, but it's not very elegant. I'll post below as a possibility. ...

How to replace a character for a newline in vim?

I'm trying :%s/,/\n/g but it inserts what looks like a ^@ instead of an actual newline, the file is not on DOS mode or anything. What should I do? EDIT: If you are curious, like me, check this other question as well. ...

how to replace multiple strings together in Oracle

I have a string coming from a table like "can no pay{1},as your payment{2}due on {3}". I want to replace {1} with some value , {2} with some value and {3} with some value . Is it Possible to replace all 3 in one replace function ? or is there any way I can directly write query and get replaced value ? I want to replace these strings i...

What's the best tool to find and replace regular expressions over multiple files?

Preferably free tools if possible. Also, the option of searching for multiple regular expressions and each replacing with different strings would be a bonus. ...

PHP replace double backslashes "\\" to a single backslash "\"

Okay so im working on this php image upload system but for some reason internet explorer turns my basepath into the same path, but with double backslashes instead of one; ie: C:\\Documents and Settings\\kasper\\Bureaublad\\24.jpg This needs to become C:\Documents and Settings\kasper\Bureaublad\24.jpg. ...

Alternative to String.Replace

So I was writing some code today that basically looks like this: string returnString = s.Replace("!", " ") .Replace("@", " ") .Replace("#", " ") .Replace("$", " ") .Replace("%", " ") .Replace("^", " ") .Replace("*", " ") .Replace("_", " ") .R...

How do I replace the *first instance* of a string in .NET?

I want to replace the first occurrence in a given string. How can I accomplish this in .NET? ...

Simplest way to use "BeanUtils alike" replace

Is there any libraries that would allow me to use the same known notation as we use in BeanUtils for extracting POJO parameters, but for easily replacing placeholders in a string? I know it would be possible to roll my own, using BeanUtils itself or other libraries with similar features, but I didn't want to reinvent the wheel. I would...

Replace an item in a list in Common Lisp?

I have a list of things (I'll call it L), an index(N) and a new thing(T). If I want to replace the thing in L at N with T, what is the best way to do this? Should I get the sublist up to N and from N to the end of the list and then glue together a new list from the first part, T, and the last part using list? Or is there a better way to ...

Replace in multiple files - graphical tool for Linux

It needs to be graphical. No sed, awk, grep, perl, whatever. I know how to use those and I do use them now, but I need to cherry-pick each replace in 300+ files. I want a tool where I can: type a search string type a replace string select a directory and file extension and it would recursively go into each file in that directory and...

Best way to replace a whole directory tree in Subversion?

Within my Subversion project I have a few directories that contain other open source projects that my code needs. For example ffmpeg, freetype, matrixssl and a few others. What is the best way to update SVN to hold the the latest version of one of these projects? Essentially I will be doing the following (using ffmpeg as an example): ...

Global Find and Replace in Visual Studio

I have a solution with multiple projects and we need to do some serious global replacements. Is there a way to do a wildcard replacement where some values remain in after the replace? So, for instance if I want every HttpContext.Current.Session[“whatevervalue”] to become HttpContext.Current.Session[“whatevervalue”].ToString() the strin...

Replacing spaces using regex in php

I'm pretty new to regular expressions. I have a requirement to replace spaces in a piece of multi-line text. The replacement rules are these: Replace all spaces at start-of-line with a non-breaking space ( ) Replace any instance of repeated spaces (more than one space together) with the same number of non-breaking-spaces Single s...

Ant replace multiple lines of text

I have an xml file where I need to comment out a whole piece of text with Ant. There's this ant task <replace file="${src.dir}/Version.as" token="@revisionPrana" value="${revision}"/> that I use to replace words, but in my case I need to replace a whole block like this: <value> <object class="edumatic.backoffice.view...

What's the best tool or method to search for a specific word in a codebase?

What tool or method do you recommend to find and replace values in your code? If code is on Linux/Unix, are find and grep the best method? I'm currently using Dreamweaver's find and replace and it's sloooow. ...

Java: Easiest way to replace strings with random strings

A string will be made up of certain symbols (ax,bx,dx,c,acc for example) and numbers. ex: ax 5 5 dx 3 acc c ax bx I want to replace one or all of the symbols (randomly) with another symbol of the same set. ie, replace one of {ax,bx,dx,c,acc} with one of {ax,bx,dx,c,acc}. replacement example: acc 5 5 dx 3 acc c ax bx or c 5 5 dx 3 acc ...

Best Way to Replace a Visual Component in Delphi

In a Delphi Form, I would like to replace one visual component with another. Example: I want to replace a Panel component with an ElPanel from a 3rd party package. I would like all identical properties and events of the first component to be transferred to the new one, and all the components that belong to the first component (e.g. Too...

Is there an alternative to string.Replace that is case-insensitive?

I need to search a string and replace all occurances of %FirstName% and %PolicyAmount% with a value pulled from a database. The problem is the capitalization of FirstName varies. That prevents me from using the String.Replace() method. I've seen web pages on the subject that suggest Regex.Replace(strInput, strToken, strReplaceWith, Rege...

Is there a simple way to do bulk file text substitution in place?

First of all, I'm a Perl newbie, so please be gentle =) I've been trying to code a Perl script to substitute some text on all source files of my project. I'm in need of something like: perl -p -i.bak -e "s/thisgoesout/thisgoesin/gi" *.{cs,aspx,ascx} But that parses all the files of a directory recursively. I just started a script: ...