By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,981 Members | 1,098 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,981 IT Pros & Developers. It's quick & easy.

Parse String in Quotes as without Quotes

P: n/a
Hello EveryOne

In my project I have to parse a string in Quotes as without Quotes.I tried
the following code but it didn't work to me.
I again getting the string with Quotes, Can Anybody suggest me where I went
wrong?

Thanks in advance.

code:
strAssociation = "rundll32.exe"

If strAssociation.StartsWith("""") Then

strAssociation = Trim(Mid(strAssociation, 2))

If strAssociation.IndexOf("""") > 0 Then

strAssociation = Left(strAssociation,
strAssociation.IndexOf("""") - 1)

End If

End If
May 18 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Vignesh are you sure that the quotes are there, in the debugger the string
is showed with Quotes.

You have to look in a messagebox or something to see if there are no quotes.

I think that the people in the C# newsgroup are not so happy with your
crossposting by the way, with complete typical VB code.

Cor

"vighnesh" <vi******@nannacomputers.com> schreef in bericht
news:ef**************@TK2MSFTNGP02.phx.gbl...
Hello EveryOne

In my project I have to parse a string in Quotes as without Quotes.I tried
the following code but it didn't work to me.
I again getting the string with Quotes, Can Anybody suggest me where I
went wrong?

Thanks in advance.

code:
strAssociation = "rundll32.exe"

If strAssociation.StartsWith("""") Then

strAssociation = Trim(Mid(strAssociation, 2))

If strAssociation.IndexOf("""") > 0 Then

strAssociation = Left(strAssociation,
strAssociation.IndexOf("""") - 1)

End If

End If

May 18 '06 #2

P: n/a
vighnesh wrote:
Hello EveryOne

In my project I have to parse a string in Quotes as without Quotes.I tried
the following code but it didn't work to me.
I again getting the string with Quotes, Can Anybody suggest me where I went
wrong?

Thanks in advance.

code:
strAssociation = "rundll32.exe"

If strAssociation.StartsWith("""") Then

strAssociation = Trim(Mid(strAssociation, 2))

If strAssociation.IndexOf("""") > 0 Then

strAssociation = Left(strAssociation,
strAssociation.IndexOf("""") - 1)

End If

End If

A string constant has to be given in quotes. A string variable will
always display its value in debug with the quotes. What is it you are
actually trying to do with this non-quoted string?

T
May 18 '06 #3

P: n/a
vighnesh wrote:
Hello EveryOne

In my project I have to parse a string in Quotes as without Quotes.I tried
the following code but it didn't work to me.
I again getting the string with Quotes, Can Anybody suggest me where I went
wrong?


strAssociate = strAssociate.Trim(new char[]{'"'});

Or you could replace the quotes with "" if you wanted to for the whole
string.

Or the quote character might just be the debugger display :)

<...>

JB
May 19 '06 #4

P: n/a
ThankYou VeryMuch

Regards
Vighneswar
"John B" <jb******@yahoo.com> wrote in message
news:44********@news.iprimus.com.au...
vighnesh wrote:
Hello EveryOne

In my project I have to parse a string in Quotes as without Quotes.I
tried the following code but it didn't work to me.
I again getting the string with Quotes, Can Anybody suggest me where I
went wrong?


strAssociate = strAssociate.Trim(new char[]{'"'});

Or you could replace the quotes with "" if you wanted to for the whole
string.

Or the quote character might just be the debugger display :)

<...>

JB

May 19 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.