The Conroy & Conroy Subroutine Library (2021.3 edition)

SetLength
What: void function
File:
Layer: 1
Format: SetLength( str, length )
Platforms: C++, C#, Javascript, Pascal, PHP, Python

This resizes the specified string to be the specified length. If the length is smaller than the current string, the string is truncated. If the length is longer than the string, the string is right-padded with spaces to the specified length. In Pascal, this is only defined if the version of Pascal being used does not provide the function.

Note: In Python, the passed string is not modified - instead, the function returns the string with the specified length.