Jump to content
Sign in to follow this  
IndeedPete

Length of a String

Recommended Posts

Hello there,

is there some way to determine the length of a string in SQF, like in programming (e.g. length(aString), wich returns an Integer)?

Thank you! :)

Share this post


Link to post
Share on other sites

Updated answer: With a3 you can count string length

count _str
 

old answer:

 

This might be helpful

http://kronzky.info/snippets/strings/index.htm

Tho it's old I guess since the toArray function is already implemented
http://community.bistudio.com/wiki/toArray

So this might be easier:

_str = "HELLO";
_len = count (toArray _str);
hint str _len;
Edited by cuel
  • Like 1

Share this post


Link to post
Share on other sites

_str = "HELLO";
_len = count (toArray _str);
hint str _len;

Thanks, that does the job! Still strange though that you can count an array but not a string...

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
Sign in to follow this  

×