Parse String in Quotes as without Quotes

  • Thread starter Thread starter vighnesh
  • Start date Start date
V

vighnesh

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
 
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 said:
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
 
vighnesh said:
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
 
ThankYou VeryMuch

Regards
Vighneswar
John B said:
vighnesh said:
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
 
Back
Top