string
Factor documentation > Factor handbook > The language > Collections > Strings
Next:string? ( object -- ? )


Vocabulary
strings

Word description
The class of fixed-length character strings. See Character and string syntax for syntax and Strings for general information.

Definition
USING: sequences.private ;

IN: strings

BUILTIN: string
{ length array-capacity read-only initial: 0 } aux ;


Methods
USING: bootstrap.image.private strings ;

M: string ' [ emit-string ] cache-eql-object ;


USING: help.markup io strings ;

M: string ($instance) write ;


USING: fjsc kernel strings ;

M: string (parse-factor-quotation) ast-string boa ;


USING: strings vocabs vocabs.loader.private ;

M: string (require) create-vocab (require) ;


USING: io io.encodings.string io.encodings.utf8 kernel
sequences serialize serialize.private strings ;

M: string (serialize)
[
115 write1
[ add-object ]
[ utf8 encode [ length serialize-cell ] [ write ] bi ]
bi
] serialize-shared ;


USING: farkup strings ;

M: string (write-farkup) ;


USING: accessors assocs kernel mongodb.tuple.collection
mongodb.tuple.collection.private strings ;

M: string <mdb-tuple-collection>
collection-map [ ] [ key? ] 2bi
[ at ] [
[ mdb-tuple-collection new dup ] 2dip
[ [ >>name ] keep ] dip set-at
] if ; inline


USING: accessors arrays asn1 byte-arrays kernel namespaces pack
sequences strings ;

M: string >ber
tagnum get value>> 1array "C" pack-native
swap dup length >ber-length-encoding swapd append
swap >byte-array append ;


USING: ascii poker.private sequences strings ;

M: string >ckf >upper 1 cut (>ckf) ;


USING: arrays io.servers io.servers.private strings ;

M: string >insecure internet-server 1array ;


USING: strings ui.gadgets.labels ;

M: string >label <label> ;


USING: alien.c-types pack strings ;

M: string >n-byte-array heap-size >n-byte-array ;


USING: accessors http http.client.post-data.private
io.encodings.string io.encodings.utf8 kernel strings ;

M: string >post-data
utf8 encode
"application/octet-stream" <post-data> swap >>data ;


USING: strings txon txon.private ;

M: string >txon encode-value ;


USING: accessors combinators kernel sequences strings urls
urls.private ;

M: string >url
[ <url> ] dip parse-url {
[
first [
[ first >>protocol ] [
second
[ first ~quotation~ when* ] [
second parse-host ~quotation~
~quotation~ bi*
] bi
] bi
] when*
]
[ second >>path ]
[ third >>query ]
[ fourth >>anchor ]
} cleave dup host>> [ [ "/" or ] change-path ] when ;


USING: inverse kernel strings xml.syntax.inverse ;

M: string [undo-xml] [ =/fail ] curry ;


USING: io.pathnames kernel namespaces splitting strings ;

M: string absolute-path
"resource:" ?head
[ trim-head-separators resource-path absolute-path ] [
"vocab:" ?head
[ trim-head-separators vocab-path absolute-path ] [
"~" ?head [
trim-head-separators home prepend-path
absolute-path
] [ current-directory get prepend-path ] if
] if
] if ;


USING: strings tools.coverage ;

M: string add-coverage [ add-coverage ] each-word ;


USING: furnace.utilities strings ;

M: string adjust-redirect-url ;


USING: furnace.utilities strings ;

M: string adjust-url ;


USING: accessors irc.client.internals kernel strings ;

M: string annotate-message [ name>> ] dip strings>privmsg ;


USING: kernel sequences.deep strings ;

M: string branch? drop f ;


USING: graphviz.builder.private graphviz.ffi strings ;

M: string build-alien-endpoint agnode ;


USING: html.templates io strings ;

M: string call-template* write ;


USING: math.functions sequences strings
ui.gadgets.tables.private ui.text ;

M: string cell-dim single-line text-dim first2 ceiling 0 ;


USING: irc.client.base irc.client.chats irc.client.internals
kernel strings ;

M: string chat-put chat> +server-chat+ or chat-put ;


USING: accessors assocs irc.client.base strings ;

M: string chat> irc> chats>> at ;


USING: accessors kernel strings ;

M: string clone (clone) [ clone ] change-aux ; inline


USING: accessors io kernel strings ui.gadgets.panes
ui.gadgets.scrollers ui.gadgets.wrappers ;

M: string content-gadget
[ write ] curry make-pane <scroller> { 450 100 } >>pref-dim
<wrapper> ;


USING: sequences strings tools.coverage tools.coverage.private
;

M: string count-callables [ count-callables ] map-words sum ;


USING: arrays kernel strings tools.coverage ;

M: string coverage [ dup coverage 2array ] map-words ;


USING: strings tools.coverage ;

M: string coverage. [ coverage. ] each-word ;


USING: mongodb.driver strings ;

M: string create-collection
<mdb-collection> create-collection ;


USING: alien.libraries compiler.cfg.builder.alien strings ;

M: string dlsym-valid? dlsym ;


USING: strings ui.gadgets.tables.private ui.text ;

M: string draw-cell single-line draw-text ;


USING: strings ui.text ui.text.private ;

M: string draw-text draw-string ;


USING: editors strings ;

M: string edit edit-vocab ;


USING: effects strings ;

M: string effect>string ;


USING: kernel sequences strings ;

M: string equal?
over string?
[ 2dup [ hashcode ] bi@ eq? [ sequence= ] [ 2drop f ] if ]
[ 2drop f ] if ;


USING: debugger io strings ;

M: string error. print ;


USING: debugger strings ;

M: string expected>string ;


USING: io.files.info.unix.private kernel math.bitwise strings ;

M: string file-mode? [ stat-mode ] dip mask? ;


USING: fjsc peg strings ;

M: string fjsc-parse 'expression' parse ;


USING: fuel.pprint prettyprint strings ;

M: string fuel-pprint pprint ; inline


USING: kernel strings unix unix.ffi unix.groups
unix.groups.private ;

M: string group-struct
(group-struct)
[ [ getgrnam_r ] unix-system-call drop ] keep
check-group-struct ;


USING: irc.client.internals irc.messages.parser strings ;

M: string handle-input
string>irc-message handle-reader-message t ;


USING: kernel strings strings.private ;

M: string hashcode*
nip dup string-hashcode
[ ] [ dup rehash-string string-hashcode ] ?if ;


USING: io.encodings.utf8 io.files kernel locals sequences
strings xmode.catalog xmode.highlight ;

M:: string highlight. ( path -- )
path utf8 file-lines
[ path over first find-mode highlight-lines ] unless-empty
;


USING: strings xml-rpc xml.data xml.syntax.private ;

M: string item>xml
1 nenum T{ xml-chunk
{ seq
V{
""
T{ tag { name ~name~ } { children ~vector~ } }
""
}
}
} interpolate-xml ;


USING: accessors sequences strings ;

M: string length length>> ; inline


USING: accessors kernel sbufs sequences strings strings.private
;

M: string like
drop dup string? [
dup sbuf? [
[ length ] [ underlying>> ] bi 2dup length eq?
[ nip dup reset-string-hashcode ] [ resize-string ]
if
] [ >string ] if
] unless ; inline


USING: html.components strings ;

M: string link-href ;


USING: html.components strings ;

M: string link-title ;


USING: accessors kernel strings ui.gadgets ui.gadgets.editors
ui.tools.listener ;

M: string listener-input
get-listener input>>
[ set-editor-string ] [ request-focus ] bi ;


USING: images.loader io.encodings.binary io.files kernel
strings ;

M: string load-image*
[ binary <file-reader> ] dip stream>image ;


USING: game.models.loader game.models.loader.private kernel
strings ;

M: string load-models* [ open-models-file ] dip stream>models ;


USING: geo-ip math.parser math.vectors sequences splitting
strings ;

M: string lookup-ip
"." split [ string>number ] map { 16777216 65536 256 1 } v.
lookup-ip ;


USING: accessors kernel slots strings ;

M: string make-slot <slot-spec> swap >>name ;


USING: kernel sbufs sequences strings ;

M: string new-resizable drop <sbuf> ; inline


USING: kernel sequences strings ;

M: string new-sequence drop 0 <string> ; inline


USING: kernel math sequences.private strings strings.private ;

M: string nth-unsafe [ integer>fixnum ] dip string-nth ; inline


USING: strings syndication xml xml.entities.html ;

M: string parse-feed
[ string>xml xml>feed ] with-html-entities ;


USING: pdf.values pdf.values.private sequences strings ;

M: string pdf-value escape-string "(" ")" surround ;


USING: kernel prettyprint.backend prettyprint.custom strings ;

M: string pprint* dup "\"" "\"" pprint-string ;


USING: prettyprint.sections see.private strings ;

M: string pprint-slot-name text ;


USING: present strings ;

M: string present ;


USING: help.markup io strings ;

M: string print-element [ write ] ($span) ;


USING: io.pathnames kernel strings unix.linux.proc ;

M: string proc-pid-path
[ "/proc/" ] 2dip [ append-path ] dip append-path ;


USING: make strings xml.syntax.private ;

M: string push-item , ;


USING: http.server.redirection strings ;

M: string relative-to-request ;


USING: strings tools.coverage ;

M: string remove-coverage [ remove-coverage ] each-word ;


USING: kernel splitting strings vocabs ;

M: string require
dup ".private" ?tail [
over lookup-vocab
[ 2drop ] [ nip call-require-hook ] if
] [ nip call-require-hook ] if ;


USING: strings tools.coverage ;

M: string reset-coverage [ reset-coverage ] each-word ;


USING: sequences.private strings ;

M: string resize resize-string ; inline


USING: alien.c-types alien.data classes.struct io.sockets
io.sockets.private kernel strings unix.ffi ;

M: string resolve-host
f prepare-addrinfo f void* <ref>
[ getaddrinfo addrinfo-error ] keep void* deref
addrinfo memory>struct [ parse-addrinfo-list ] keep
freeaddrinfo ;


USING: strings unix.groups unix.groups.private ;

M: string set-effective-group ?group-id (set-effective-group) ;


USING: strings unix.users unix.users.private ;

M: string set-effective-user ?user-id (set-effective-user) ;


USING: io.files.info.unix kernel strings unix.groups ;

M: string set-file-group group-id f swap set-file-ids ;


USING: io.files.info.unix strings unix.users ;

M: string set-file-user user-id f set-file-ids ;


USING: accessors images.loader images.viewer strings ;

M: string set-image load-image >>image ;


USING: kernel math sequences.private strings strings.private ;

M: string set-nth-unsafe
dup reset-string-hashcode
[ integer>fixnum ] [ integer>fixnum ] [ ] tri*
set-string-nth ; inline


USING: strings unix.groups unix.groups.private ;

M: string set-real-group ?group-id (set-real-group) ;


USING: strings unix.users unix.users.private ;

M: string set-real-user ?user-id (set-real-user) ;


USING: kernel make sequences smalltalk.printer strings ;

M: string smalltalk>string
[ "'" % [ dup 39 = [ dup , , ] [ , ] if ] each "'" % ] ""
make ;


USING: combinators io json.writer kernel sequences strings ;

M: string stream-json-print
34 over stream-write1 swap [
{
{ 34 [ "\\\"" over stream-write ] }
{ 13 [ ] }
{ 10 [ "\\r\\n" over stream-write ] }
[ over stream-write1 ]
} case
] each 34 swap stream-write1 ;


USING: arrays kernel math sequences splitting strings ;

M: string string-lines
dup [ "\r\n" member? ] any? [
"\n" split [
but-last-slice [
dup ?last 13 = [ but-last ] when
[ 13 = ] split-when
] map! drop
] [
[ length 1 - ] keep
[ [ 13 = ] split-when ] change-nth
] [ concat ] tri
] [ 1array ] if ;


USING: accessors alien.strings byte-arrays io
io.streams.byte-array kernel strings ;

M: string string>alien
over check-string <byte-writer>
[ stream-write ] [ 0 swap stream-write1 ]
[ stream>> >byte-array ] tri ;


USING: alien.strings io.encodings.utf8 strings ;

M: string string>symbol utf8 string>alien ;


USING: strings ui.text ui.text.private ;

M: string text-dim string-dim ;


USING: strings unix.groups unix.groups.private ;

M: string user-groups (user-groups) ;


USING: kernel strings unix.ffi unix.users ;

M: string user-passwd getpwnam dup [ passwd>new-passwd ] when ;


USING: assocs io kernel mongodb.cmd mongodb.connection
mongodb.driver strings ;

M: string validate.
[ validate-cmd make-cmd ] dip "validate" set-cmd-opt
send-cmd [ check-ok nip ] keep [ [ "result" ] ] dip
[ at print ] curry compose [ ] if ;


USING: io.pathnames kernel strings vocabs.loader
vocabs.loader.private ;

M: string vocab-path
dup find-root-for
[ prepend-path ] [ not-found-in-roots ] if* ;


USING: db.queries strings ;

M: string where object-where ;


USING: io.sockets strings ;

M: string with-port <inet> ;


USING: html.components.private io strings ;

M: string write-nested write ;


USING: cuda.ptx io strings ;

M: string write-ptx-operand write ;


USING: io io.crlf kernel math.parser
redis.command-writer.private sequences strings ;

M: string write-value-with-length
[ length number>string write crlf ] [ write ] bi ;


USING: io kernel namespaces sequences strings
unicode.categories wrap.strings xml.entities xml.writer
xml.writer.private ;

M: string write-xml
escape-string xml-pprint? get [
dup [ blank? ] all?
[ drop "" ]
[ nl 80 indent-string wrap-indented-string ] if
] when write ;