Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Tk::Text question
Hi,

I want to count how many blank lines are at the end of a Tk::Text.
Then I want to adjust that to N blank lines (1, actually).

I'm trying to use ...

$my_text->search()

...but the search wraps around to the beginning of the widget.

Thanks

Report this thread to moderator Post Follow-up to this message
Old Post
RonH
03-27-08 12:29 AM


Re: Tk::Text question
On Mar 26, 1:30 pm, RonH <harti...@gmail.com> wrote:
> Hi,
>
> I want to count how many blank lines are at the end of a Tk::Text.
> Then I want to adjust that to N blank lines (1, actually).
>
> I'm trying to use ...
>
> $my_text->search()
>
> ...but the search wraps around to the beginning of the widget.
>
> Thanks

Why search if you know where they are?

-textvariable => \$text

$text =~ s/\n*$/\n/;

Report this thread to moderator Post Follow-up to this message
Old Post
smallpond
03-27-08 12:29 AM


Re: Tk::Text question
On Mar 26, 5:48 pm, smallpond <smallp...@juno.com> wrote:
> On Mar 26, 1:30 pm, RonH <harti...@gmail.com> wrote:
> 
> 
> 
> 
> 
> 
>
> Why search if you know where they are?
>
> -textvariable => \$text
>
> $text =~ s/\n*$/\n/;

Hi smallpond,
Thanks. I didn't think of this approach so it is helpful. I will try
it.
A couple of things I see are: 1) I do want to count lines with
whitespace as blank lines and 2) I want to add a blank line if none is
present.
So maybe...

text =~ s/(\s*\n)*/\n/;
Ron

Report this thread to moderator Post Follow-up to this message
Old Post
RonH
03-29-08 12:15 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PerlTk archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:57 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.