For Gauche 0.9.10

Next: , Previous: , Up: ライブラリモジュール - SRFI   [Contents][Index]

11.25 srfi-130 - Cursor-based string library

Module: srfi-130

This is an reduced version of srfi-13 that supports cursors in addition to indexes. The consistency with R7RS and recent srfis are also considered.

The following are built-in. See 文字列カーソル, for the details.

string-cursor?        string-cursor-start    string-cursor-end
string-cursor-next    strig-cursor-prev      string-cursor-forward
string-cursor-back    string-cursor=?        string-cursor<?
string-cursor<=?      string-cursor>?        string-cursor>=?
string-cursor-diff    string-cursor->index   string-index->cursor

The following procedures are simply aliases of the builtin version without the /cursor or /cursors suffix.

string->list/cursors  string->vector/cursors string-copy/cursors
string-ref/cursor     substring/cursors

The following procedures are defined in srfi-13. See 文字列ライブラリ, for the details. Note: Some of those procedures in srfi-13 accept only indexes (e.g. string-index). In srfi-130, both indexes and cursors are accepted. Our srfi-13 implementation shares the same procedure with srfi-130, so they accept both indexes and cursors but such code won’t be portable as srfi-13.

string-null?       string-any         string-every       string-tabulate
string-unfold      string-unfold-right                   reverse-list->string
string-take        string-drop        string-take-right  string-drop-right
string-pad         string-pad-right   string-trim        string-trim-right
string-trim-both   string-replace     string-prefix-length
string-suffix-length                  string-prefix?     string-suffix
string-concatenate string-concatenate-reverse            string-count
string-filter      string-reverse

The following procedures are also defined in srfi-13 and redefined in srfi-130. However, for operations going from left to right, the srfi-130 version returns a cursor instead of an index when found or (string-cursor-end) of the input string when not found. For operations going from right to left, it returns a cursor representing a successor of the matching character when found, or (string-cursor-begin) of the input string when not found. In contrast, the srfi-13 version returns either an index when found or #f otherwise.

string-fold        string-fold-right   string-index
string-index-right string-skip         string-skip-right

string-contains is defined the same as srfi-13. However the srfi-130 returns a cursor when a string is found, and #f otherwise. In contrast, the srfi-13 version returns an index or #f. string-contains-right is similar to string-contains except that the searching start from the end of the string.

string-for-each-cursor is similar to string-for-each-index from srfi-13 but proc will take the cursor instead of the index.

xsubstring and string-delete in srfi-13 are renamed string-replicate and string-remove respectively in srfi-130. Similar to srfi-152, the to argument is required in string-replicate.

string-split is the same as one from srfi-152 or gauche.stringutil module.

Next: , Previous: , Up: ライブラリモジュール - SRFI   [Contents][Index]