Jump to content

A question about find,gsub


ScaWscR

Recommended Posts

Hello guys,

A string : DATA = "DataPlayer"

the data len is #DATA = 9

i want change it to:

if #DATA > 7 then

"DTaPlay.."

how can i do it ?

end

2 e.g

Datax = "MTAsangoodplayers"

to ;

if #Datax > 7 then

to;

"MTAsango.."

end

I hope you understand me

It was a bit confused

Link to comment

I once made something like that for a Rankingboard, maybe its what you need.

It works fine for me, but you should probably not use it inside a render function.

function RankingBoard.dxClipTextToWidth(text, width) 
  
    while dxGetTextWidth(text, RankingBoard.fontSize, RankingBoard.font, true) > width do 
     
        text = text:sub(1, #text-1) 
     
    end 
     
    return text 
  
end 

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