Thanks. Regular expressions *isn't* what I wanted. (When I've tried
them before [in Python] they made Python seem fast.)
On 03/31/2011 05:06 PM, Thomas Chust wrote:
2011/4/1 Charles Hixson:
[...]
I'm trying to determine whether the last non-whitespace character of a
string is a colon, an
; lnic -- last non-white is colon
(define (lnic? s) ; explode to list
(let loop ((cs (reverse (string->list s
(cond ((null? cs) #f)
((char-whitespace? (car cs)) (loop (cdr cs)))
(else (char=? (car cs) #\:)
(define (lnic? s) ; index into string
(let loop ((i (-
Here is what people are talking about when they say do it w/o regular
expressions:
#lang racket
(require srfi/13)
(define (ends-in-: s)
(define t (string-trim-right s))
(and (> (string-length t) 0) (char=? (string-ref t (- (string-length t) 1))
#\:)))
(ends-in-: "abc")
(ends-in-: " abc
Eli Barzilay wrote at 03/31/2011 07:46 PM:
Two minutes ago, Charles Hixson wrote:
Hi, I'm trying to determine whether the last non-whitespace character of a
string is a colon,
(define (last-non-ws str)
(cond [(regexp-match #px"(\\S)\\s*$" " \t") => cadr]
[else #f]))
then
2011/4/1 Charles Hixson :
> [...]
> I'm trying to determine whether the last non-whitespace character of a
> string is a colon, and I haven't been able to figure out the best way of
> doing this. In python I'd just trim the string and look at the character
> before the end,
> [...]
Hello,
well,
Two minutes ago, Charles Hixson wrote:
> Hi, I'm trying to determine whether the last non-whitespace
> character of a string is a colon, and I haven't been able to figure
> out the best way of doing this. In python I'd just trim the string
> and look at the character before the end, but while Rack
On Thu, Mar 31, 2011 at 7:38 PM, Charles Hixson
wrote:
> Hi,
> I'm trying to determine whether the last non-whitespace character of a
> string is a colon, and I haven't been able to figure out the best way of
> doing this. In python I'd just trim the string and look at the character
> before the
7 matches
Mail list logo