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

How would I use string manipulation to replace the hyphens with spaces?

Asked by 9 years ago
1local num = 1923919
3local sub = string.sub(FaceID, 18)
4local rev = string.reverse(sub)
5local ot  = string.sub(rev, string.len(num) + 12)  

This script prints Orange-Sparkle-Time-Fedora like its supposed to. But what I need to do is replace the hyphens with spaces, but how would I do that?

2 answers

Log in to vote
3
Answered by
NotSoNorm 777 Moderation Voter
9 years ago

String.gsub replaces any letter/number with another letter/number

so it'd b lik dis cuti patooti

1FaceID = string.gsub(FaceID,"-"," ")
Ad
Log in to vote
1
Answered by
funyun 958 Moderation Voter
9 years ago

There's the string.gsub function, which replaces things with other things.

1ot = ot:gsub("-", " ") --Replace hyphen with space

Answer this question