473,466 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

replacing quotes within a string variable

I am a newbie to VB.NET (and VB in general).

I'd like to replace quote marks with the string.

For example, I have a string that is "3dmesh 45 45" including the quotes.

I'd like to remove the quotes and end up with the string equal to (literally) 3dmesh 45 45

I'm using LineofText = Replace(LineofText, "3dmesh 45 45", 3dmesh 45 45)

Obviously, this doesn't work. Is there a way to remove quote marks in strings using the replace function? Are there any other ways to accomplish this?

Thanks.

Tim Barbour
ti****@att.net

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
Nov 20 '05 #1
2 11541
"TimothyBarbour" <timbar@-NOSPAM-att.net> schrieb
I'd like to replace quote marks with the string.

For example, I have a string that is "3dmesh 45 45" including the
quotes.

I'd like to remove the quotes and end up with the string equal to
(literally) 3dmesh 45 45

I'm using LineofText = Replace(LineofText, "3dmesh 45 45",
3dmesh 45 45)

Obviously, this doesn't work. Is there a way to remove quote marks
in strings using the replace function? Are there any other ways to
accomplish this?


Dim s As String = """3dmesh 45 45 """ '-> "3dmesh 45 45"

s = s.Replace("""", "") 'replace
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
* TimothyBarbour <timbar@-NOSPAM-att.net> scripsit:
I am a newbie to VB.NET (and VB in general).

I'd like to replace quote marks with the string.

For example, I have a string that is "3dmesh 45 45" including the quotes.

I'd like to remove the quotes and end up with the string equal to (literally) 3dmesh 45 45

I'm using LineofText = Replace(LineofText, "3dmesh 45 45", 3dmesh 45 45)


\\\
.... = Replace(LineOfText, """2dmesh 45 45""", "3dmesh 45 45")
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

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

Similar topics

5
by: sinister | last post by:
The examples in the online manual all seem to use double quotes, e.g. at http://us3.php.net/preg_replace Why? (The behavior is different with single quotes, and presumably simpler to...
6
by: Cyrus D. | last post by:
Hi guys, I haven't done that much research on this topic but it seems I can use either the single quotes or the double quotes. SInce I am so used to C(++) I prefer the double quotes and am...
11
by: Jakanapes | last post by:
Hi all, I'm looking for a way to scan a block of text and replace all the double quotes (") with single quotes ('). I'm using PHP to pull text out of a mySQL table and then feed the text into...
1
by: JehanNYNJ | last post by:
I have to put some html into a variable like so.... var html = '<TABLE cellspacing="5" border="0" ....... But within this html string I also need to have the code for a button that traps the...
5
by: Joel | last post by:
Hi, I incorporated a function in my code that whenever I use a string variable in an sql statement if the string contains a single quote it will encase it in double quotes else single quotes. ...
1
by: asd987 | last post by:
Hi, Ihave to print a field (type memo) to a file. I know how to do that ;-), but there's one complication: all single quotes (') in the record must be replaced by <backslash> + <single quote>...
24
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double...
4
by: Justin Fancy | last post by:
Hi everyone, I need to replace all instances of a double quote(") with two single quotes('') in a text file. I already have some replacements of strings going on, but I tried this one, but the...
4
by: Milsnips | last post by:
Hi there, i'm trying to do a string replace on something like the following string MyString = myinput; myinput = myinput.Replace("src="../content/","http://www.site.com/content/") but, the...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.