Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago

-- 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

Log in to vote
1
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

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.)

Ad

Answer this question