Reputation: 173
How do you calculate the length of the string that would be returned by Array::pack? Is there something like Python's calcsize?
Upvotes: 3
Views: 453
Reputation: 1327
array.pack("").count I would say. Not really the fastest method, but it works.
Upvotes: 1
Reputation: 4841
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.
Upvotes: 0