{"size": 1338, "ext": "scrbl", "max_stars_repo_path": "gui-doc/scribblings/gui/string-snip-class.scrbl", "max_stars_repo_name": "jjsimpso/gui", "max_stars_repo_stars_event_min_datetime": "2015-03-17T22:11:52.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-12T15:09:34.000Z", "max_issues_repo_path": "gui-doc/scribblings/gui/string-snip-class.scrbl", "max_issues_repo_name": "jjsimpso/gui", "max_issues_repo_issues_event_min_datetime": "2015-01-09T15:53:25.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T16:21:29.000Z", "max_forks_repo_path": "gui-doc/scribblings/gui/string-snip-class.scrbl", "max_forks_repo_name": "jjsimpso/gui", "max_forks_repo_forks_event_min_datetime": "2015-01-08T13:03:07.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-26T21:49:09.000Z"}
{"max_stars_count": 65, "max_issues_count": 231, "max_forks_count": 89, "avg_line_length": 28.4680851064, "max_line_length": 71, "alphanum_fraction": 0.6786248132}
#lang scribble/doc
@(require "common.rkt")

@defclass/title[string-snip% snip% ()]{

An instance of @racket[string-snip%] is created automatically when
 text is inserted into a text editor. See also @xmethod[text%
 on-new-string-snip].


@defconstructor*/make[(([allocsize exact-nonnegative-integer? 0])
                       ([s string?]))]{

Creates a string snip whose initial content is @racket[s], if
 supplied, empty otherwise. In the latter case, the optional
 @racket[allocsize] argument is a hint about how much storage space
 for text should be initially allocated by the snip.

}


@defmethod[(insert [s string?]
                   [len exact-nonnegative-integer?]
                   [pos exact-nonnegative-integer? 0])
           void?]{

Inserts @racket[s] (with length @racket[len]) into the snip at relative
 @techlink{position} @racket[pos] within the snip.

}


@defmethod[(read [len exact-nonnegative-integer?]
                 [f (is-a?/c editor-stream-in%)])
           void?]{

Reads the snip's data from the given stream. 

The @racket[len] argument specifies the maximum length of the text to
 be read.  (When a text snip is written to a file, the very first
 field is the length of the text contained in the snip.)  This method
 is usually invoked by the text snip class's @method[snip-class% read]
 method.

}}

