Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

quotations 1

Status
Not open for further replies.

Zarcom

Programmer
May 7, 2002
1,275
CA
i seem to have forgotten how to add a "double quote" to a string. VB just thinks I have ended the string and gets mad at me.

Help?? Plz That'l do donkey, that'l do
[bravo] Mark
 
double double

"This is a string with ""double quotes"" in it"

penny1.gif
penny1.gif
 
I found it!

Dim myString As String
' The value of myString is: He said, "Look at this example!"
myString = "He said, ""Look at this example!"""

Does any one know why Incredimail doesn't read an HTML message sent from -my app this time- an application as HTML it reads it as plain text so that you see the html tags.
Incredimail does however read an html message that has been sent from eudora as html.

I am confused. That'l do donkey, that'l do
[bravo] Mark
 
set:

mailMessage.bodyFormat = MailFormat.HTML
penny1.gif
penny1.gif
 
lol I just found that too. I didn't even think about it but I was comparing the two message headers and notice that the one that wasn't working said content-type: plain/text. So I check the options on the mail message object sure enough right there is a bodyformat property!

DOh That'l do donkey, that'l do
[bravo] Mark
 
Speaking of double quotes, here's a quicky for either Zarc or Paul (hey, just an aside, I assume the both of you are making > 6 figs, eh? From what I've read, you should be!)

Anyway, here's the question. When I use the INSERT statement to stick a record I have to put a note by the comment box to tell users not to use an apostrophe, which of course, causes the INSERT to fail if it is there. I suspect JavaScript is the answer. What to do?
 
I was reading the other day in ASP.NET and there's seems to be some possibilities with STRING functionality of VB.
 
For a simple fix just to catch the apostrophe problem, you can just do a simple replace with double apostrophes:

INSERT INTO tblMine (field) VALUES ('here''s an apostrophe')

but as you know, there are many other characters that will also cause things to bomb out in code, and in sql. For instance, we have a little message board app that runs that we needed to accept any character that the user typed in, and then simply display that back out on the screen -- much like this forum does. To do this, I created a class that encodes/decodes strings to their ascii equivalents. If you are interested (or even if you're not ;-)), here's the simple class:
Code:
Public Class asciiconvert
    Public Function encode(ByVal input As String) As String
        Dim output As String
        Dim i As Integer
        For i = 0 To input.Length - 1
            output &= "&" & Asc(input.Substring(i, 1)) & ";"
        Next
        Return output
    End Function
    Public Function decode(ByVal input As String) As String
        Dim output, inputArray() As String
        Dim sb As New StringBuilder()
        Dim i As Integer
        inputArray = input.Split(";&")
        For i = 0 To inputArray.Length - 2
            If inputArray(i).Replace("&", String.Empty).Replace(";", String.Empty) = "10" Then
                sb.Append(&quot;<br>&quot;)
            Else
                sb.Append(Chr(CInt(inputArray(i).Replace(&quot;&&quot;, String.Empty).Replace(&quot;;&quot;, String.Empty))))
            End If
        Next
        output = sb.ToString()
        Return output
    End Function
End Class

this codes all special characters, including line breaks, but is specifically designed for output to be spit directly back out onto a webpage, where these characters are recognized. Sending the output to other places may or may not require extra steps for proper formatting & display.

:)
paul
penny1.gif
penny1.gif
 
Interesting take on the ASCII class Paul. My solution was merely what you had first, to do a replace on the single quote to a double.

Isadore:
I wish I was making >6. Unfortunately, I don't have the experience as I am just now finishing a work experience term. The last of which will get me an Applied Bachelors Degree. But thanks for the vote of confidence. That'l do donkey, that'l do
[bravo] Mark
 
You'll do just fine. Just keep at it. Paul, I don't know where you came from, but please don't go away. Both of you are well appreciated here at TT. I'll get back to you with the results.

Thanks.
 
ps. I just realized that the first function up there doesn't use a stringBuilder. Must've written this before I found out about them.

Please replace that w/ the following implementation:
Code:
Public Function encode(ByVal input As String) As String
    Dim output As String
    Dim sb as new stringBuilder()
    Dim i As Integer
    For i = 0 To input.Length - 1
        sb.append(&quot;&&quot; & Asc(input.Substring(i, 1)) & &quot;;&quot;)
    Next
    output = sb.toString()
    Return output
End Function
**scurries off to replace his, as well**

:)
paul
penny1.gif
penny1.gif
 
[rofl]
heehee thats funny
That'l do donkey, that'l do
[bravo] Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top