Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Trailing Whitespace

Name: Anonymous 2012-04-05 7:07

Hey everyone,

A few months ago, I posted my Python script to remove trailing whitespace from a file. Somebody responded with a Perl 1-line code that does the same thing.

I could really use that Perl code now, anybody? Thanks.

Name: Anonymous 2012-04-07 1:19

yeah, actually having regex built in to the syntax is nice. But how about this?


(define (map-lines fn input output)
  (let ((line (read-line input)))
    (if (not (eof-object? line))
      (begin (display (fn line) output)
             (newline output)
             (map-lines fn input output)))))

(define (map-input fn)
  (map-lines fn (current-input-port) (current-output-port)))

(map-input (lambda (x) (string-edit "\\s*$" "" x)))

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List