Changeset 37677 in project


Ignore:
Timestamp:
06/09/19 19:57:20 (7 days ago)
Author:
kon
Message:

fake subdomain of char

Location:
release/5/string-utils/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/5/string-utils/trunk/string-utils.egg

    r36059 r37677  
    33
    44((synopsis "String Utilities")
    5  (version "2.1.0")
     5 (version "2.1.1")
    66 (category data)
    77 (author "[[kon lovett]]")
  • release/5/string-utils/trunk/unicode-utils.scm

    r35810 r37677  
    5050  (##sys#char->utf8-string (check-char 'unicode-char->string ch)) )
    5151
     52(: *unicode-string ((list-of char) -> string))
     53;
     54(define (*unicode-string chs)
     55  (cond
     56    ((null? chs)
     57      "" )
     58    ((null? (cdr chs))
     59      (##sys#char->utf8-string (car chs)) )
     60    (else
     61      (let ((chs (map ##sys#char->utf8-string chs)))
     62        (##sys#fragments->string
     63          (foldl (lambda (l s) (fx+ l (##sys#size s))) 0 chs)
     64          chs) ) ) ) )
     65
    5266;inefficient
    5367(: unicode-string (#!rest -> string))
     
    6175        (every (cut check-char 'unicode-string <>) chs) )
    6276      (*unicode-string chs) ) ) )
     77
     78(: *unicode-make-string (fixnum char -> string))
     79;
     80(define (*unicode-make-string len fill)
     81  (cond
     82    ((fx= 0 len)
     83      "" )
     84    ;ascii-codepoint < char
     85    ((not (ascii-codepoint? fill))
     86      (*unicode-string (the (list-of char) (make-list len fill))) )
     87    (else
     88      (##sys#make-string len fill) ) ) )
    6389
    6490(: unicode-make-string (fixnum #!optional char -> string))
     
    85111    (check-natural-fixnum 'unicode-surrogates->codepoint lo "low")) )
    86112
    87 (: *unicode-make-string (fixnum char -> string))
    88 ;
    89 (define (*unicode-make-string len fill)
    90   (cond
    91     ((fx= 0 len)
    92       "" )
    93     ((ascii-codepoint? fill)
    94       (##sys#make-string len fill) )
    95     (else
    96       (*unicode-string (the (list-of char) (make-list len fill))) ) ) )
    97 
    98 (: *unicode-string ((list-of char) -> string))
    99 ;
    100 (define (*unicode-string chs)
    101   (cond
    102     ((null? chs)
    103       "" )
    104     ((null? (cdr chs))
    105       (##sys#char->utf8-string (car chs)) )
    106     (else
    107       (let ((chs (map ##sys#char->utf8-string chs)))
    108         (##sys#fragments->string
    109           (foldl (lambda (l s) (fx+ l (##sys#size s))) 0 chs)
    110           chs) ) ) ) )
    111 
    112113) ;module unicode-utils
Note: See TracChangeset for help on using the changeset viewer.