Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version

## string-replace

Arguments: text-edit-pane string replacement &key backward case-sensitive globally (line-of-padding 0)

Searches for a string in a text control, and if found replaces one or more occurrences of that string with a second string. If one or more matches were found, then the number of replacements that was done is returned; otherwise `nil` is returned.

The arguments are:

- text-edit-pane is the `text-edit-pane` or `rich-edit-pane` to search.
- string is the Lisp string to find in the window's text.
- replacement is the string with which to replace the search string if found.
- backward: if true, then the search is done toward the beginning of the buffer, starting from the character just before the current text cursor position. Otherwise the search is done toward the end of the buffer, starting from the character just after the current text cursor position. The default is `nil`, meaning do a forward search.
- case-sensitive: if true, then a case-sensitive search is done; otherwise a case-insensitive search is done. The default is `nil` meaning do a case-insensitive search.
- globally: if true, then all matches from the starting point to the end or beginning of the buffer are replaced, and the last replacement (if any) is left selected. Otherwise only the next match in the search direction (if any) is replaced, and it is left selected. The default is `nil`, meaning replace a single match only.
- lines-of-padding: when a string match is selected, the window will be scrolled as needed so that at least this many lines of text are visible both above and below the string match (when possible). This allows the user to see additional context around the string match. The value should be a non-negative integer, and the default is zero.

To ask the user interactively for the search and replacement strings, it may be useful to call ask-user-for-string or pop-up-strings-dialog.

Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version