3

How do you calculate the length of the string that would be returned by Array::pack? Is there something like Python's calcsize?

2 Answers 2

1

array.pack("").count I would say. Not really the fastest method, but it works.

Sign up to request clarification or add additional context in comments.

Comments

0

By making an interpreter complying to the specifications found in Array::pack.

Or, reusing the existing implementation to count the number of characters instead of appending them to a string.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.