Jump to content

Ajuda com formatação de texto


Recommended Posts

  • Other Languages Moderators
function stringToPhone (str)
    local ddd = "("..string.sub(str, 0, 2)..")"
    local a = string.sub(str, 3, 6).."-"
    local b = string.sub(str, 7, 10)
    return ddd..a..b
end

print (stringToPhone(1140028922)) -- Vai printar isso: (11)4002-8922

 

Edited by Lord Henry
  • Thanks 1
Link to comment

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