Quintiq file version 2.0
|
#parent: #root
|
StaticMethod ChompText (
|
String text_i
|
) const declarative remote as String
|
{
|
Description: 'Limits feedback by fixed number of characters'
|
TextBody:
|
[*
|
output := text_i;
|
maxLength := SCK_FeedbackBuilder::GetMaxFeedbackLength();
|
maxLines := SCK_FeedbackBuilder::GetMaxFeedbackLines();
|
|
// Chomp by number of characters
|
if( text_i.Length() > SCK_FeedbackBuilder::GetMaxFeedbackLength() )
|
{
|
output := text_i.SubString( 0, maxLength ) + SCK_FeedbackBuilder::FeedbackOverflowTerminator();
|
}
|
|
// In the case that there are a lot of short sentences, also chomp by lines
|
lines := text_i.Tokenize( String::NewLine() );
|
if( lines.Size() > maxLines )
|
{
|
keepLines := construct( Strings );
|
for( i := 0; i < maxLines - 1; i++ )
|
{
|
keepLines.Add( lines.Element( i ) );
|
}
|
keepLines.Add( SCK_FeedbackBuilder::FeedbackOverflowTerminator() );
|
|
output := keepLines.ToString( String::NewLine() );
|
}
|
|
return output;
|
*]
|
}
|