ColonelKernel 4 Posted August 24, 2017 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
jshock 513 Posted August 24, 2017 https://community.bistudio.com/wiki/BIS_fnc_trimString private _myShortString = [typeOf myVehicle,0,4] call BIS_fnc_trimString; 1 Share this post Link to post Share on other sites
ColonelKernel 4 Posted August 24, 2017 7 hours ago, jshock said: https://community.bistudio.com/wiki/BIS_fnc_trimString private _myShortString = [typeOf myVehicle,0,4] call BIS_fnc_trimString; Thank you! 1 Share this post Link to post Share on other sites
Grumpy Old Man 3548 Posted August 24, 2017 [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 2 1 Share this post Link to post Share on other sites
R3vo 2654 Posted August 24, 2017 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 ;) 3 Share this post Link to post Share on other sites
Grumpy Old Man 3548 Posted August 24, 2017 8 minutes ago, R3vo said: 10 times faster ;) True, my grumpy old eyes are deceiving me. Cheers Share this post Link to post Share on other sites
thy_ 168 Posted January 25, 2023 On 8/24/2017 at 7:28 AM, Grumpy Old Man said: typeOf player select [0,5]; //0.0009 ms This code line through the slicing method is so elegant 🙂 Share this post Link to post Share on other sites