After some time of debugging one of our apps, I started a witchhunt on the
StringTrim function.
basicly the error can be reduced down to the following:
It started with testing of the following text
StringTrim( "HEGE HERMANSN", 15) gives "HEGE HERMANSN" string
(note 2 spaces)
while
StringTrim( "HEGE HERMANSEN", 15) gives 'StringTrim( "HEGE HERMANSEN",
15)' threw an exception of type 'System.ArgumentOutOfRangeException' string
{System.ArgumentOutOfRangeException}
The testing followed
StringTrim( "123456789012345", 15) gives 'StringTrim( "123456789012345",
15)' threw an exception of type 'System.ArgumentOutOfRangeException' string
{System.ArgumentOutOfRangeException}
while
StringTrim( "1234567890123456", 15) gives "234567890123456" string
and
StringTrim( "12345678901234", 15) gives "12345678901234" string
In short: If the text equals in length with the trimming length, StringTrim
will cast an exception.
Can someone please inform me weather this is a known behavior, or it is an
error in stringtrim function?
Is there a workaround?