|
Subject: Re: (dsssl) Substring manipulation? From: Jany Quintard <quintard.j@xxxxxxxxxx> Date: Mon, 5 Feb 2001 10:15:07 +0100 (CET) |
On Fri, 2 Feb 2001, David Perrin wrote:
> Hi there,
>
> Trying to use the substring function but having a tough time determining the
> function to use to calculate the start position.
>
Excuse me David, but I did not check properly what I wrote in my previous
mail.
The find-first-char is NOT want you want. The proc can anyway give you
ideas. For your problem, you can try the function hereafter (untested).
This one returns -1 if the string does not contain any colon and the index
of the position of the first colon otherwise.
(define (position-of-colon strParam)
(let (max (- (string-length strParam) 1) ;; first index is 0
(let loop ((strParam strParam)
(index 0))
(if (> index max) ;; colon is not in the string
-1
(if (equal? (string-ref strParam index) #\;)
index ;; found
(loop strParam (+ 1 index))))))) ;; looping further
Jany
Any views or opinions expressed are solely those of the author
and do not necessarily represent those of IBM.
------------------------------------------------------------------------
Jany Quintard | Spam :
IBM Paris Laboratory | Spiced Pork And Ham, a sort
Application & Integration Middleware Division | of cheap luncheon meat.
DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: (dsssl) Substring manipulation?, Jany Quintard | Thread | (dsssl) jadetex tdot problem remain, Adam Di Carlo |
| Re: (dsssl) Substring manipulation?, Jany Quintard | Date | (dsssl) jadetex tdot problem remain, Adam Di Carlo |
| Month |