Function | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 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-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version