Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB: Why is this not working ?

Posted on 1997-11-30
3
Medium Priority
?
143 Views
Last Modified: 2013-12-25
The following source creates big files and doesn't change the extended characters.
Why?


Function TekstAsHTML(s As String) As String
 
 Dim N, I, strLength As Long
 Dim HTML As Variant
 HTML = Array("x", "x", "x", "‚", "ƒ", "„", "…", "†", "‡", "ˆ", "‰", "š", "‹", "œ", "x", "x", "x", "x", "‘", "’", "“", "”", "•", "–", "—", "˜", "™", "š", "›", "œ", "x", "x", "ÿ", " ", "¡", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", "­", "®", "¯", "°", "±", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "×", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ")
 Dim varTmp As String
 
 strLength = Len(s)
 
 For I = 1 To strLength
  For N = 1 To 128
   If Mid(s, N, 1) = HTML(N) And HTML(N) <> "x" Then
     TekstAsHTML = TekstAsHTML + "&" + (N + 127) + ";"
     Exit For  'ingen grund til at fortsætte hvis vi har fundet en skyldig.
    Else
     TekstAsHTML = TekstAsHTML + Mid(s, N, 1)
   End If
  Next N
 Next I
 
End Function
0
Comment
Question by:jfl
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
julio011597 earned 50 total points
ID: 1831488
Maybe:

--//--
For I = 1 To strLength
  For N = 1 To 128
    If Mid(s, I, 1) = HTML(N) And HTML(N) <> "x"
    Then
      TekstAsHTML = TekstAsHTML + "&" + (N + 127) + ";"
      Exit For 'ingen grund til at fortsætte hvis vi har fundet en skyldig.'
    Else
      TekstAsHTML = TekstAsHTML + Mid(s, I, 1)
    End If
  Next N
Next I
--//--

I.e., i guess you meant Mid(s, I, 1).
0
 

Author Comment

by:jfl
ID: 1831489
I did thanks!, but it's still creating a large file, and doesn't do what it's supposed to do!
0
 
LVL 5

Expert Comment

by:julio011597
ID: 1831490
That is because logic must be wrong, not implementation.

I guess what you're trying to do is substitute special chars with HTML escape sequences, but i'm not sure about it, because i can see a "&nbsp;" sequence there, and this make me confused.

If you tell me what your task exactly is, i could give an algorithm to work on (i cannot program VB).
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question