Jump to content

problem with string.gsub


KillerX

Recommended Posts

Posted

Hi ,

now i have this string

msg = "@#!%%^,:{}"

and i can remove all signs from this string by this way

string.gsub( msg , '%p' , '' )

tha question is : how to remove all signs from this string except this sign " , "

Thanks

                                                         هل ساعدتك في شئ ؟؟؟؟

                                                Mmpe7Jm.gif

                                                   latest?cb=20170707023932                 

                                            KillerX#9078

Posted
patterns = {"%p", ","}
for i,v in ipairs(patterns) do
    str = string.gsub(str, v, "")
end
23 minutes ago, KillerX said:

Hi ,

now i have this string


msg = "@#!%%^,:{}"

and i can remove all signs from this string by this way


string.gsub( msg , '%p' , '' )

tha question is : how to remove all signs from this string except this sign " , "

Thanks

https://stackoverflow.com/questions/25280374/lua-string-gsub-with-multiple-patterns

Posted (edited)
11 minutes ago, AncienT said:

patterns = {"%p", ","}
for i,v in ipairs(patterns) do
    str = string.gsub(str, v, "")
end

https://stackoverflow.com/questions/25280374/lua-string-gsub-with-multiple-patterns 

i've done some tests and i've found the solution

msg = "@#!%%^,:{}"
outputChatBox( msg:gsub( '[^,]' , '' ) )

thank's anyway

Edited by KillerX

                                                         هل ساعدتك في شئ ؟؟؟؟

                                                Mmpe7Jm.gif

                                                   latest?cb=20170707023932                 

                                            KillerX#9078

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...