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

IS there a way to remove some text from a string?

-- If I put Message = "Hello, how are you daddawd doing?")

Is it possible to remove a part from a string If I wanted to remove the "daddawd"

Message:GetFullName("daddawd"):Remove()

Is the best I have so far. Not working however

Is it possible to remove a part from a string?

1 answer

GetFullName() gets the full path of an instance, it doesn't work on strings.

To remove a part from a string you can use

string.find, string.sub, string.gsub, string.match, string.gmatch

The one i'd suggest the most is gsub.

string.gsub(STRING, PATTERN, REPLACE,(optional) Callback)

print(string.gsub("Hello, world!", "Hello", "Bye")) --> "Bye, world!"

These things are a bit hard to explain, so i suggest reading upon the Roblox Wiki (As i assume you're not aware there's a wiki when you attempt to call GetFullName on a string.)

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