On this page:
DEFAULT_  STRING
whole/  pattstr
group/  pattstr
or/  pattstr
make-extension-pattern-string
unix-reserved-character-pattern-string
windows-reserved-character-pattern-string
windows-reserved-name-pattern-string
maybe-spaces-pattern-string
non-empty-bytes?
make-rx-matcher
file-name-string?
get-shortest-string
string->value
non-empty-string
8.0

22 String Processing

 (require xiden/string) package: xiden

xiden/string extends and reprovides racket/string.

This module defines useful regular expressions and string operations needed by other modules.

value

DEFAULT_STRING : non-empty-string? = "default"

The conventional default of the non empty strings.

procedure

(whole/pattstr s)  string?

  s : string?
Returns (string-append "^" s "$").

procedure

(group/pattstr s)  string?

  s : string?
Returns (string-append "(" s ")").

procedure

(or/pattstr opt ...)  string?

  opt : string?
Returns (string-append "(?:" (string-join opts "|") ")").

procedure

(make-extension-pattern-string exts ...)  string?

  exts : string?
Returns a pattern string suitable for pregexp that matches a dot, followed by one of the given exts at the end of the subject.

A pattern string suitable for pregexp that matches / or null characters.

These are pattern strings suitable for pregexp. They track Windows reserved file names.

windows-reserved-character-pattern-string matches any character reserved by Windows for file names. windows-reserved-name-pattern-string matches any character sequence that looks like a reserved Windows file name.

A pattern string suitable for pregexp that matches zero or more whitespace characters.

Returns #t when applied to a non-empty byte string.

procedure

(make-rx-matcher pattern-string    
  [#:whole whole?])  (-> string? (or/c #f list?))
  pattern-string : string?
  whole? : any/c = #t
Returns a procedure. That procedure returns (and (string? s) (regexp-match (pregexp (if whole? (whole/pattstr p) p))) s) when applied to a string s.

Returns #t if the value is a string, and that string is useable as a cross-platform file name.

procedure

(get-shortest-string strings)  string?

  strings : (listof string?)
Returns the shortest element of strings.

Current use cases:

procedure

(string->value s)  any/c

  s : string?
Equivalent to (read (open-input-string s)).

Current use case:

syntax-class

non-empty-string

A syntax class for matching non-empty strings in macros.