Is there a way to change a string's length directly?
AFAIK, there isn't. Use the `SubStr' function (like BP's `copy' function) to shorten a string, and the `+' operator to make it longer.
Well, the problem is, I said "efficiently". I don't assume, gpc would optimize statements like s:=s+'a' where s is a (possibly quite long) string, so I'd have O(n) where actually O(1) is possible. E.g. the examples from the documentation about converting CStrings to Pascal strings append char by char in a loop -- O(n^2) instead of O(n). I don't think that should be left as it is.
And of course you can take a pointer to the string, cast it to a pointer to a record the fields of which you can manipulate like you wish ...
I'd have to do it like this if there's no other way... But shouldn't it be possible to access the fields of the "string record" in a direct way? Perhaps in the course of the schema project? (Are you planning to make strings regular schema types then -- regular except for the extended syntax that allows s[n]?)