<RefEntry id="length-string-number-part">
<!-- This file is generated automatically from the DSSSL source. -->
<!-- Do not edit this file! -->
<?html-filename length-string-number-part.html>

<RefMeta>
  <RefEntryTitle>length-string-number-part</RefEntryTitle>
  <RefMiscInfo Role="file">dblib.dsl</RefMiscInfo>
</RefMeta>

<RefNameDiv>
  <RefName>length-string-number-part</RefName>
  <RefPurpose>Returns the numeric part of a length string</RefPurpose>
</RefNameDiv>

<RefSynopsisDiv><Title>Synopsis</Title>
<Synopsis>
(length-string-number-part lenstr)
</Synopsis>
</RefSynopsisDiv>

<RefSect1><Title>Description</Title>

<para>
Given a length as a string, return the numeric part.</para>


</RefSect1>

<RefSect1><Title>Example</Title>

<para>
<literal>"100pt"</literal> returns <literal>"100"</literal>. <literal>"30"</literal> returns <literal>"30"</literal>.  
<literal>"in"</literal> returns <literal>""</literal>.
</para>


</RefSect1>

<RefSect1><Title>Author</Title>

<para>
Norman Walsh, &lt;ndw@nwalsh.com&gt;
</para>
</RefSect1>
<RefSect1><Title>Source Code</Title>

<ProgramListing>
(define (length-string-number-part lenstr)
  ;; Returns the numeric part of a length string
  (let ((digits '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9 #\.)))
    (let loop ((chars (string->list lenstr))
	       (number-part ""))
      (if (or (null? chars) (not (member (car chars) digits)))
	  number-part
	  (loop (cdr chars) (string-append number-part 
					   (string (car chars))))))))
</ProgramListing>
</RefSect1>

</RefEntry>
