Thanks heaps guys (John and David)
8-)
David.
John W. Krahn wrote:
David Buddrige wrote:
Hi all,
I have a group of C++ source files where I have the following text on a
single Lines:
class MyReallyLongClassNameThatIsTooLongToFitInEightyCharacters : public
SomeClassTemplate<InstantiatedDataType>
What I want to do is to split this line at the ":" so that everything
after the colon appears on the next line (indented 4 characters) like so:
class MyReallyLongClassNameThatIsTooLongToFitInEightyCharacters
: public SomeClassTemplate<InstantiatedDataType>
I have written the following code:
while(<>)
{
$code_line = $_;
$length_of_codeline = length( $code_line );
if ( $length_of_codeline > 80 )
{
if ( $code_line =~
m|class(\s)+([a-zA-z])+(\w)*(\s)+:(\s)+public(\s)+([a-zA-z])+(\w)*<[a-zA-Z](\w)+>|
)
{
# At this point, I know I've found the line, I need to
# split it somehow.
$code_line =~ s/:\s*/:\n /;
}
}
}
This code identifies the line in question, but having done so, I am not
sure how to split it into two lines (at the colon). Can anyone suggest
how I'd do that?
John
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]