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 8 years ago
    local num = 1923919
    local FaceID = "http://rproxy.pw/Orange-Sparkle-Time-Fedora-item?id=215751161"
    local sub = string.sub(FaceID, 18)
    local rev = string.reverse(sub)
    local 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
8 years ago

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

so it'd b lik dis cuti patooti

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

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

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

Answer this question