Quintiq file version 2.0
|
#parent: #root
|
Method PTF_RemoveTextBetween (
|
String body,
|
String startsymbol,
|
String endsymbol
|
) as String id:Method_LibPTF_pnlTestRunner_PTF_RemoveTextBetween
|
{
|
#keys: '[104342.0.874315317]'
|
Body:
|
[*
|
// Helper method to remove strings between the start and end indicator
|
resultbody := body;
|
|
// Remove everything between startsymbol and endsymbol.
|
// Both startsymbol and endsymbol are also removed, unless the last character of endsymbol is a newline.
|
// In that case the newline is not removed.
|
idxstart := resultbody.FindString( startsymbol, 0 );
|
while( idxstart >= 0 )
|
{
|
idxend := resultbody.FindString( endsymbol, idxstart + 1 );
|
if( idxend < 0 )
|
{
|
idxend := resultbody.Length() - endsymbol.Length();
|
}
|
|
removeLength := endsymbol.Length();
|
resultbody := resultbody.Replace( idxstart, idxend - idxstart + removeLength, "" );
|
|
idxstart := resultbody.FindString( startsymbol, idxstart );
|
}
|
|
return resultbody;
|
*]
|
}
|