UnHtml$()

New to Gambas? Post your questions here. No question is too silly or too simple.
Post Reply
paco
Posts: 15
Joined: Friday 11th February 2022 5:42pm

UnHtml$()

Post by paco »

Hi, is there a reverse function to the Html$()-function? Thanks!
User avatar
BruceSteers
Posts: 1582
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: UnHtml$()

Post by BruceSteers »

paco wrote: Wednesday 14th June 2023 8:06pm Hi, is there a reverse function to the Html$()-function? Thanks!
Probably String.FromHTML() of gb.util component
http://gambaswiki.org/wiki/comp/gb.util/string/fromhtml

Maybe UnQuote() will do?
http://gambaswiki.org/wiki/lang/unquote

As all Html() does is "quote" a string so it's safe for html.

or maybe FromUrl() might do what you need?
http://gambaswiki.org/wiki/lang/fromurl
If at first you don't succeed , try doing something differently.
BruceS
User avatar
cogier
Site Admin
Posts: 1127
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: UnHtml$()

Post by cogier »

paco wrote: Wednesday 14th June 2023 8:06pm Hi, is there a reverse function to the Html$()-function? Thanks!
Experimenting with the tricks Bruce posted, I came up with this: -

Public Sub Form_Open()

  Dim sHtml As String = "Charlie was 'ere!"

  sHtml = Html(sHtml)
  Print sHtml

  sHtml = String.FromHTML(sHtml)
  Print sHtml

End


The result: -

Charlie was 'ere!
Charlie was 'ere!
paco
Posts: 15
Joined: Friday 11th February 2022 5:42pm

Re: UnHtml$()

Post by paco »

Thanks! FromHTML() is not documented under String-Functions in https://gambas.sourceforge.net/en/main.html#
User avatar
BruceSteers
Posts: 1582
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: UnHtml$()

Post by BruceSteers »

paco wrote: Tuesday 20th June 2023 7:08pm Thanks! FromHTML() is not documented under String-Functions in https://gambas.sourceforge.net/en/main.html#
Indeed because it is not a native function but part of the component gb.util.

I have just added a gb.util string link to the "See also" part of the "String functions" page (it will not show on the wiki until tomorrow.)
If at first you don't succeed , try doing something differently.
BruceS
Post Reply