How to find length of string in a macro?

XPP 9.2.2 on Windows Server 2012

We have a model in the first column of a table. Some models are too long and crash with the text in the next table column. We cannot change table column widths as they  must be the same through the whole book. How do I automatically find the length of the model to squeeze the text using <sw> if the model is too long?

We did this with prices by looking at the value of the number. But I haven't found a way to do this with strings yet. Does anyone have any ideas?

I looked in the macro book but did not see a macro for len() or length() or strlen().

My basic idea was to store the model in a macro like this: <model;HS1234kdkdkdkdkdk>

The <model> macro definition would be something like this: <mc;len($1)]10;sw(&-.5q);nul> <mc; len($1)]15;sw(&-1q);nul>$1

Thank you.

Parents Reply Children