Remove html tags / replace <br> etc with its html style (Create a break) from api response

I am pulling data from a wordpress website and I get tags like these:

image

I had to upload an image because they are html tags and they only show what it is meant to be such as an apostrophe or speech marks.

I am wondering, is there any way to remove html tags in thunkable x? If not where is the best place to find the most common html tags so I can use the replace text block and just make a load of them.

All comments are much appreciated!

To clear the tags you need to create your own algorithm. For example, lines of the form &#1234; are deleted like this: find the left position of the next line “&#” and then the right position - the symbol “;”. After that, delete the substring from the left position to the right one inclusively.

Similarly, tags are deleted, only you need to look for the characters “<” and “>”.

If one of these tags includes a " or something of that like, would they be automatically replaced by thunkable app? Thanks

Sorry, but I did not understand your question. Removing or replacing something will happen as you programmed in blocks.

The label shows up things like < p > and < /p > and I think for < br > as well. I need it to show it as it would look in html. I am linking to a wordpress blog and the blog of course contains things like this, and the json from the wordpress site sends me this data but i need the label to interpret it or remove it. i would rather it acted like html though.

I understand correctly that you want to keep some tags and remove others? If so, then either make exceptions when searching and replacing tags, or first convert the non-removable tags to unique characters, delete the rest, and finally do the reverse conversion.

I have exceptions for tags that look like […] and speech marks and all that stuff, and I have set them to replace with what they mean, if you get me?

But it is really important that I get the paragraphs as it is a news article that I am dealing with.

Thanks again for your help, i really do appreciate it!

here is an example of the data that i am dealing with.

image

I need it to show as it would in a html viewer. Thanks

To display this text as in a browser, you need to use WebViewer and the data URI protocol.

An example is shown on the scrHtml screen.

https://x.thunkable.com/projects/5cd84f23e3097f3353fdad45/project/properties/designer/

In your example you join the html together. Does this matter? I just have one massive string.

This is my code: image

App description is the text that I have above but it still does nothing. I changed it to URI protocol in the advanced settings.

You can give me your text in txt format, which I can copy, and look at their devices.

Certainly.

The texts vary so here are 3 examples.

Examples.txt (13.5 KB)

Thanks

I looked at examples. Take the second text example. I added it to the WebViewer and in iOS on Live, paragraphs and characters \ n between them are displayed.

Other texts are also displayed without problems. What is your problem and in what case?

I set that text now as the url and i get nothing

can you share a photo of your code for that, if there is any? Thanks

also i am on android 9, samsung one ui, device is samsung s8

Also does the image show up in the text?

In my example, the data URI is used. If you paste the text in the URL, it does not show anything.

Images are not displayed, because you need to fix the html code for them - everything \" replace on ".

https://x.thunkable.com/projects/5d14a294922190073307f81d/project/properties/designer/

1 Like

ahh okay. I understand now. You joined the data uri thing at the start, then the actual html code that I got.

So is there a way to add images into the html? And here is what I am getting now in web viewer:

Photo links still show, and i get the html tags for things like speech marks and apostrophes.

And thank you for this help. I really do appreciate it!