Info from ""'s into string. 
Author Message
 Info from ""'s into string.

I have a richtextbox where user's type in commands. When
a user types in print "Texthere" I need to take the info
in ""s and place it into a string. I've seen this done but
for the life of me I cant figure out how to do it. Anyone
have some idea's?

Example:

Command:
print "Some Text"

Code:
strPrint = "Some Text"



Tue, 01 Feb 2005 09:08:44 GMT  
 Info from ""'s into string.
Try this:

strPrint = richtextbox.text.replace("""","")

HTH

David



Quote:
> I have a richtextbox where user's type in commands. When
> a user types in print "Texthere" I need to take the info
> in ""s and place it into a string. I've seen this done but
> for the life of me I cant figure out how to do it. Anyone
> have some idea's?

> Example:

> Command:
> print "Some Text"

> Code:
> strPrint = "Some Text"



Tue, 01 Feb 2005 09:50:47 GMT  
 Info from ""'s into string.
All that does is get rid of the " marks.

Unless I miss my guess, Jester means that he wants the portion of the string
*between* the " marks.

Here's a little console app that shows one way to do this.  The very last
line gives the answer you are looking for.

Imports System.Text.RegularExpressions

Module Module1

    Sub Main()
        Dim re As New Regex("(?:\"")(.+)(?:\"")")
        Dim str As New String("John said, ""this is it"" with enthusiasm")
        Dim theMatches As GroupCollection = re.Match(str).Groups
        Console.WriteLine(theMatches.Count)
        Console.WriteLine(theMatches.Item(0))
        Console.WriteLine(theMatches.Item(1))

    End Sub

End Module

We hope this is what you needed.

Thanks,
VB.Net Team

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> Try this:

> strPrint = richtextbox.text.replace("""","")

> HTH

> David



> > I have a richtextbox where user's type in commands. When
> > a user types in print "Texthere" I need to take the info
> > in ""s and place it into a string. I've seen this done but
> > for the life of me I cant figure out how to do it. Anyone
> > have some idea's?

> > Example:

> > Command:
> > print "Some Text"

> > Code:
> > strPrint = "Some Text"



Wed, 02 Feb 2005 04:10:08 GMT  
 Info from ""'s into string.
That is exacly what I wanted. Thanks!




Quote:
> All that does is get rid of the " marks.

> Unless I miss my guess, Jester means that he

wants the portion of the string
Quote:
> *between* the " marks.

> Here's a little console app that shows one way

to do this.  The very last
Quote:
> line gives the answer you are looking for.

> Imports System.Text.RegularExpressions

> Module Module1

>     Sub Main()
>         Dim re As New

Regex("(?:\"")(.+)(?:\"")")
Quote:
>         Dim str As New String("John said, ""this

is it"" with enthusiasm")
Quote:
>         Dim theMatches As GroupCollection =

re.Match(str).Groups
Quote:
>         Console.WriteLine(theMatches.Count)
>         Console.WriteLine(theMatches.Item(0))
>         Console.WriteLine(theMatches.Item(1))

>     End Sub

> End Module

> We hope this is what you needed.

> Thanks,
> VB.Net Team

> --
> This posting is provided "AS IS" with no

warranties, and confers no rights.
Quote:

> "David Williams"


message
Quote:

> > Try this:

> > strPrint = richtextbox.text.replace("""","")

> > HTH

> > David




> > > I have a richtextbox where user's type in
commands. When
> > > a user types in print "Texthere" I need to
take the info
> > > in ""s and place it into a string. I've seen
this done but
> > > for the life of me I cant figure out how to
do it. Anyone
> > > have some idea's?

> > > Example:

> > > Command:
> > > print "Some Text"

> > > Code:
> > > strPrint = "Some Text"



Wed, 02 Feb 2005 05:58:03 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Parsing CSV strings like "Doe, John",33, "6'2"""

2. Parsing CSV strings like "Doe, John",33, "6'2"""

3. *"*-.,._,.-*"* I"LL TRADE VISUAL C++ FOR VBASIC *"*-.,_,.-*"*

4. How to Replace("String Irregular # of space", "?", "")

5. reading body info in a "reportitem"

6. forgot e-mail in : "info on...."

7. Rufnummernidentifikation zur "D-Info 99"

8. "System Info" of App Wizard fails

9. Wer hat Info zu "RegGetKeySecurity"?

10. "Symbolic Debug Info" File

11. Replace(strEntity,"'","''") doubles single quotes in database

12. Strange "Expected '('" Error

 

 
Powered by phpBB® Forum Software