Quintiq file version 2.0
|
#parent: #root
|
StaticMethod FormatCSV (
|
String string
|
) as String
|
{
|
Description:
|
[*
|
Format the result to CSV format
|
Maintain by R&D
|
*]
|
TextBody:
|
[*
|
// jasperb Mar-7-2012 (created)
|
|
result := string;
|
|
newlinestring := BenchmarkUtilities::NewLineString();
|
delimiter := BenchmarkUtilities::Delimiter();
|
|
if( string.FindString( delimiter, 0 ) > 0 )
|
{
|
error( 'newlinestring', delimiter, 'already used' );
|
}
|
|
if( string.FindString( newlinestring, 0 ) > 0 )
|
{
|
error( 'newlinestring', newlinestring, 'already used' );
|
}
|
|
quoteclosed := true;
|
|
for( position := 0; position < result.Length() ; position++ )
|
{
|
substring := result.SubString( position, 1 );
|
|
if( substring = "'" )
|
{
|
quoteclosed := not quoteclosed;
|
}
|
else if( quoteclosed and substring = "," )
|
{
|
result := result.Replace( position, 1, delimiter );
|
}
|
}
|
|
return result.ReplaceAll( String::NewLine(), newlinestring );
|
*]
|
}
|