Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I remove part of a string?

For example:

local StringToAction = "TESTING <script></script>" -- Using httpservice as an example

I would like to remove the tags whilst also removing their inner content.

1 answer

✓ Accepted answer

Using this:

local StringToAction = "Testing <script></script>"

local start, temp1 = StringToAction:find("<script>")
local temp2, endS = StringToAction:find("</script>", temp1)

local CleansedString = StringToAction:sub(1, start - 1) .. "" .. StringToAction:sub(endS + 1, StringToAction:len())

5 comments

1

The code provided seems to only remove "Testing" instead of the HTML.

0

Woops, sorry, forgot a 1. Let me edit the post.

0

Try it now.

1

It works now, thanks. [Please edit "end" inside your answer to be "endd" or something else in-case an amateur doesn't find that error.]

0

Haha, didn't even notice that meself, thanks.

This discussion is preserved as it was. New answers, comments, and votes are closed.