Jump to content
ColonelKernel

Limit the number of characters in a string

Recommended Posts

Hi.

Is it possible to limit the number of characters in a string variable?

For example, let's say I use "typeOf" to get the name of a vehicle. How can I display the first five characters of its name?

Share this post


Link to post
Share on other sites
[typeOf player,0,4] call BIS_fnc_trimString;//0.0105 ms
//vs
typeOf player select [0,5];//0.0009 ms

Almost 100x faster. Quite a speed increase for free.

 

Cheers

  • Like 2

Share this post


Link to post
Share on other sites
5 hours ago, Grumpy Old Man said:

[typeOf player,0,4] call BIS_fnc_trimString;//0.0105 ms
//vs
typeOf player select [0,5];//0.0009 ms

Almost 100x faster. Quite a speed increase for free.

 

Cheers

 

10 times faster ;)

  • Like 2

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×