473,396 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Find and Replace

me
Hi,

I have a text box that is name txtQuote.

Enduser might type in txtQuote:
It is unbelievable <a
href="http://sports.yahoo.com/sc/news?slug=reu-tourtrial_picture&prov=reuter
s&type=lgns">Armstrong is on <font color="red"FIRE</font></a>.

How do I convert the < to &lt; and > to &gt;?
TIA
Nov 17 '05 #1
6 6158
It looks like your post of "How do I convert the < to < and > to >?"
got converted to its HTML entity translations on Google Groups since
they all "look" identical. The simple way is to use the string Replace
method. For example,
string s="It is unbelievable <a
href="http://sports.yahoo.com/sc/news?slug=reu-tourtrial_picture&prov=reuter

s&type=lgns">Armstrong is on <font color="red"FIRE</font></a>";

s=s.Replace("<", "&lt;");

Nov 17 '05 #2
It looks like your post of "How do I convert the < to < and > to >?"
got converted to its HTML entity translations on Google Groups since
they all "look" identical. The simple way is to use the string Replace
method. For example,
string s="It is unbelievable <a
href="http://sports.yahoo.com/sc/news?slug=reu-tourtrial_picture&prov=reuter

s&type=lgns">Armstrong is on <font color="red"FIRE</font></a>";

s=s.Replace("<", "&lt;");

Nov 17 '05 #3
string convertedString = HttpUtility.HttpEncode(txtQuote.Text);
other than that, you could use a RegEx replace

--
Floyd

"me" <wu*****************@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,

I have a text box that is name txtQuote.

Enduser might type in txtQuote:
It is unbelievable <a
href="http://sports.yahoo.com/sc/news?slug=reu-tourtrial_picture&prov=reuter
s&type=lgns">Armstrong is on <font color="red"FIRE</font></a>.

How do I convert the < to &lt; and > to &gt;?
TIA

Nov 17 '05 #4
string convertedString = HttpUtility.HttpEncode(txtQuote.Text);
other than that, you could use a RegEx replace

--
Floyd

"me" <wu*****************@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,

I have a text box that is name txtQuote.

Enduser might type in txtQuote:
It is unbelievable <a
href="http://sports.yahoo.com/sc/news?slug=reu-tourtrial_picture&prov=reuter
s&type=lgns">Armstrong is on <font color="red"FIRE</font></a>.

How do I convert the < to &lt; and > to &gt;?
TIA

Nov 17 '05 #5
HI,

I've same situation, (I'm a beginner in C#.)
I want to replace a PARAM value on every page load (or refresh).
my HTML code is something like this:

<form id="Form1" method="post" runat="server">
<OBJECT id="ShowLevel" classid="clsid:9F2B3505-199C-11D2-9E4E-00AA002156AE"
VIEWASTEXT>
<PARAM NAME="Level" VALUE="36">
...
</OBJECT>

I want to change VALUE to any integer, but with code behind (C#) only.
Please guide.

Regards,
Sachin M
"Floyd Burger" wrote:
string convertedString = HttpUtility.HttpEncode(txtQuote.Text);
other than that, you could use a RegEx replace

--
Floyd

"me" <wu*****************@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,

I have a text box that is name txtQuote.

Enduser might type in txtQuote:
It is unbelievable <a
href="http://sports.yahoo.com/sc/news?slug=reu-tourtrial_picture&prov=reuter
s&type=lgns">Armstrong is on <font color="red"FIRE</font></a>.

How do I convert the < to < and > to >?
TIA


Nov 17 '05 #6
HI,

I've same situation, (I'm a beginner in C#.)
I want to replace a PARAM value on every page load (or refresh).
my HTML code is something like this:

<form id="Form1" method="post" runat="server">
<OBJECT id="ShowLevel" classid="clsid:9F2B3505-199C-11D2-9E4E-00AA002156AE"
VIEWASTEXT>
<PARAM NAME="Level" VALUE="36">
...
</OBJECT>

I want to change VALUE to any integer, but with code behind (C#) only.
Please guide.

Regards,
Sachin M
"Floyd Burger" wrote:
string convertedString = HttpUtility.HttpEncode(txtQuote.Text);
other than that, you could use a RegEx replace

--
Floyd

"me" <wu*****************@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,

I have a text box that is name txtQuote.

Enduser might type in txtQuote:
It is unbelievable <a
href="http://sports.yahoo.com/sc/news?slug=reu-tourtrial_picture&prov=reuter
s&type=lgns">Armstrong is on <font color="red"FIRE</font></a>.

How do I convert the < to < and > to >?
TIA


Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: hokieghal99 | last post by:
import os, string print " " setpath = raw_input("Enter the path: ") def find_replace(setpath): for root, dirs, files in os.walk(setpath): fname = files for fname in files: find =...
7
by: Bart Nessux | last post by:
x = str.find(temp, '120.50') I am looking for '120.50' '120.51' '122.78' etc. How can I do this with just one str.find... I can use re if I must, but I'd like to avoid it if possible.
1
by: Xah Lee | last post by:
suppose you want to do find & replace of string of all files in a directory. here's the code: ©# -*- coding: utf-8 -*- ©# Python © ©import os,sys © ©mydir= '/Users/t/web'
2
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data...
1
by: James Vitale | last post by:
Using vb asp.net 1.1 I'm doing a word automation on a doc file and trying to do a find and replace. My existing code works fine except that it doesn't find and replace in the header. My code...
0
by: Xah Lee | last post by:
Interactive Find and Replace String Patterns on Multiple Files Xah Lee, 2006-06 Suppose you need to do find and replace of a string pattern, for all files in a directory. However, you do not...
0
by: Rave | last post by:
This is a long shot, but I thought I'd try it. I am currently using excel as an inventory tool. I currently have a hand-held scanner plugged into a laptop for reading barcodes. Using the "Find and...
2
by: john | last post by:
In a table I have text field A. I would like to replace all the null values in field A to a real value, let's say 'Test'. When I use Find & Replace and I search for 'is null' and I press replace or...
3
by: TOXiC | last post by:
Hi everyone, First I say that I serched and tryed everything but I cannot figure out how I can do it. I want to open a a file (not necessary a txt) and find and replace a string. I can do it...
3
by: mouac01 | last post by:
Newbie here. How do I do a find and replace in a binary file? I need to read in a binary file then replace a string "ABC" with another string "XYZ" then write to a new file. Find string is the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.