Android Question Download website strings

Douglas Farias

Expert
Licensed User
Longtime User
hi its possible download all strings from my website
but not with html ?

<br>teste</br>


i want download only
teste

not with <br>

its possible ? *-*
 

Douglas Farias

Expert
Licensed User
Longtime User
dont have another way?

my website have many tags
<h2> <h3> etc

example

HTML:
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" lang="pt-br" xml:lang="pt-br">
<head>
<title>Achou, ganhou!</title>
<META HTTP-EQUIV="REFRESH" CONTENT="180; URL=index.php">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="css/style.css" rel="stylesheet" type="text/css" media="all">
</head>
<body>           
                <div class="fullwrap">
                <div class="content">
                    <h2>Cidade: São Leopoldo</h2>
                    <h2 style="background-color:#1F2C3E;">Pr&oacute;xima dica entre: 16:10 - 20:00</h2>
                    <h2> Dica 3: O objeto onde se encontra o dinheiro fica a céu aberto, e não dentro de 4 paredes e um teto.</h2>
                </div>
            </div>
            </body>
</html>

i need download and remove all tags?

if have <h2> remove <h2> this ? *-*
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
@NJDude
How i call this

B4X:
Sub RemoveTags(Text As String) As String

    Dim Pattern, Replacement As String
    Dim m As Matcher

    Pattern = "<[^>]*>"
    Replacement = " "

    m = Regex.Matcher2(Pattern, Regex.CASE_INSENSITIVE, Text)

    Dim r As Reflector
  
    r.Target = m

    Return r.RunMethod2("replaceAll", Replacement, "java.lang.String")

End Sub


i m trying
B4X:
dim casa as string
dim xuxu as string

casa = Html 'html is my downloaded site strings
xuxu = RemoveTags(casa) ' try call the sub here with my text
Msgbox(xuxu,"teste")
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
B4X:
MsgBox(RemoveTags(Html), "")
dont work show a null msgbox

'edit
ty my code works but only on activity resume
B4X:
dim casa as string
dim xuxu as string

casa = Html 'html is my downloaded site strings
xuxu = RemoveTags(casa) ' try call the sub here with my text
Msgbox(xuxu,"teste")

very thx
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
yes is working i need call the msgbox on resume activity xD
resolved ty man
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…