3 Using Characters and Strings

3.4 Reference pages

base-string-p Function

simple-base-string-p Function

Syntax:base-string-p object

Syntax:simple-base-string-p object

The predicatebase-string-p is true if its argument is of typebase-string.

The predicatesimple-base-string-p is true if its argument is of typesimple-base-string.

characterp Function

Syntax:characterp object&optional repertoire

The predicatecharacterp is true if its argument is a character.

The optional repertoire argument specifies the character repertoire. If the optional argument is specified, the predicate is true if its argument is a character object of that particular repertoire.

> (characterp #\rubout) 
T

> (characterp #\newline :ascii) T

> (characterp #\a :base) T

> (characterp 12) NIL

char-external-code Function

Syntax:char-external-code character character-set-name

The functionchar-external-code returns a non-negative integer that is the index of the specified character within the specified character set. If the character is not encoded in the character set, the function returnsnil.

This function returns the encoding used to represent the character in a file on disk; the external encoding may be different from the internal encoding for the character.

The character-set-name argument is a keyword that identifies the coded character set. Table 3.3 shows the possible values for this keyword.

Keyword values for character-set-name
PlatformKeywordCharacter set named
HP:hp15double-byte HP15
 :asciisingle-byte ASCII
RS6000:shift-jisdouble-byte PC932 (Shift JIS)
 :asciisingle-byte ASCII
SunOS/Solaris:eucdouble-byte in EUC codeset 1
 :asciisingle-byte ASCII in EUC codeset 0

See Also: char-external-code-limit

char-external-code-limit Function

Syntax:char-external-code-limit character-set-name

The functionchar-external-code-limit returns the upper exclusive bound of the value returned by the function char-external-code for the specified character set.

The character-set-name argument is as for char-external-code.

See Also: char-external-code

*default-character-element-type* Variable

Syntax:*default-character-element-type*

The variable*default-character-element-type* specifies the default string format for the following strings:

In addition, the value of*default-character-element-type* is the default element type for the functionopen. Once a stream has been opened, all strings constructed by the reader will be in this format.

The initial value of*default-character-element-type* depends on the value of the environment variableLANG. It ischaracter if the value ofLANG is eitherjapanese orjapan. Otherwise, it isbase-character.

Although this variable is not included in the ANSI standard, Liquid Common Lisp provides this variable so that code that does not use double-byte characters can retain its efficiency.

> *default-character-element-type* 
BASE-CHARACTER

;;; Override the default value so we can load a file containing ;;; double-byte character data: > (let ((*default-character-element-type* 'character)) (load "dbcs.lisp")) ;;; Loading source file "dbcs.lisp" #P"/u/dru/dbcs.lisp"

*default-external-format* Variable

*default-base-external-format* Variable

Syntax:*default-external-format*

Syntax:*default-base-external-format*

The variable*default-external-format* specifies the default value for the:external-format keyword of the functionopen, when the:element-type keyword is specified as'character. The initial value of*default-external-format* differs for each supported platform and is shown in Table 3.1 on page 25.

The variable*default-base-external-format* specifies the default value for the:external-format keyword of the functionopen, when the:element-type keyword is specified as'base-character. The initial value of*default-base-external-format* differs for each supported platform and is shown in Table 3.2 on page 25.

Although variables are not included in the ANSI standard, Liquid Common Lisp provides these variables so that code can process files containing double-byte characters in a variety of encodings.

fast-read-dbcs-char Function

fast-write-dbcs-char Function

Syntax:fast-read-dbcs-char stream&optional eof-error-p eof-value recursivep

Syntax: fast-write-dbcs-char char stream

These functions are similar tofast-read-char andfast-write-char except that they are designed to be used with extended characters.

They work with streams that have been opened with:element-type 'character. Since theextended-character type is a subtype ofcharacter, these functions are capable of handling both double-byte and Single-byte characters.

These functions do not maintain output-column information.

See Also:read-char,write-char (in Common Lisp: The Language);fast-read-char,fast-write-char (in the Advanced User's Guide).

find-external-char Function

Syntax:find-external-char character-set-name char-external-code

The functionfind-external-char returns a character object that is encoded at the specified character index within the specified character set. Since the character set mapping might be sparse, the function can returnnil if there is no legal character with the index given.

The character-set-name argument is as forchar-external-code(see char-external-code on page 28 for details).

The char-external-code argument is a non-negative integer.

general-string-p Function

simple-general-string-p Function

Syntax:general-string-p object

Syntax: simple-general-string-p object

The predicategeneral-string-p is true if its argument is of typegeneral-string.

The predicatesimple-general-string-p is true if its argument is of typesimple-general-string.

sbchar Function

sgchar Function

Syntax:sbchar simple-base-string index

Syntax: sgchar simple-general-string index

The functionssbchar andsgchar access a single character element of a string. These functions are identical to the Common Lisp functionschar, except thatsbchar requires a simple base string argument andsgchar requires a simple general string argument.

See Also:schar (in Common Lisp: The Language)


International Character Sets - 9 SEP 1996

Generated with Harlequin WebMaker