Home All Groups Group Topic Archive Search About

Parse String in Quotes as without Quotes

Author
18 May 2006 3:54 PM
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

Author
18 May 2006 4:28 PM
Cor Ligthert [MVP]
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

Show quoteHide quote
"vighnesh" <vighn***@nannacomputers.com> schreef in bericht
news:efxVoNpeGHA.1208@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
>
>
Are all your drivers up to date? click for free checkup

Author
18 May 2006 4:29 PM
tomb
vighnesh wrote:

Show quoteHide quote
>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
Author
19 May 2006 1:22 AM
John B
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
Author
19 May 2006 9:56 AM
vighnesh
ThankYou VeryMuch

Regards
Vighneswar
Show quoteHide quote
"John B" <jbngspam@yahoo.com> wrote in message
news:446d1d83_1@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



Post Thread options