{"size": 832, "ext": "scrbl", "max_stars_repo_path": "lens-doc/unstable/lens/substring.scrbl", "max_stars_repo_name": "AlexKnauth/lens", "max_stars_repo_stars_event_min_datetime": "2015-07-08T12:56:46.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-17T21:21:54.000Z", "max_issues_repo_path": "lens-doc/unstable/lens/substring.scrbl", "max_issues_repo_name": "AlexKnauth/lens", "max_issues_repo_issues_event_min_datetime": "2015-07-07T01:47:59.000Z", "max_issues_repo_issues_event_max_datetime": "2019-09-10T18:35:17.000Z", "max_forks_repo_path": "lens-doc/unstable/lens/substring.scrbl", "max_forks_repo_name": "AlexKnauth/lens", "max_forks_repo_forks_event_min_datetime": "2015-07-07T05:01:29.000Z", "max_forks_repo_forks_event_max_datetime": "2019-07-16T00:37:04.000Z"}
{"max_stars_count": 66, "max_issues_count": 199, "max_forks_count": 11, "avg_line_length": 37.8181818182, "max_line_length": 79, "alphanum_fraction": 0.6862980769}
#lang scribble/manual

@(require lens/private/doc-util/main)

@title{Substring Lenses}

@defproc[(substring-lens [start exact-nonnegative-integer?]
                         [end exact-nonnegative-integer?])
         (lens/c string? string?)]{
  Creates a lens that views a substring from @racket[start] to @racket[end]
  of a given string. @racket[start] is inclusive and @racket[end] is exclusive,
  in the same way as for @racket[substring].
  @lens-unstable-examples[
    (lens-view (substring-lens 1 4) "abcdefg")
    (lens-set (substring-lens 1 4) "abcdefg" "FOO")
  ]
  When setting a new view, the replacement string has to be
  the same length as the span of the substring lens to uphold
  the @seclink["laws"]{lens laws}.
  @lens-unstable-examples[
    (lens-set (substring-lens 1 4) "kitten" "this string is too long!")
]}