This script defines string utilities and is included in the J standard library. Definitions are loaded into the z locale.
| C | charsub, chopstring, cut, cuts | 
| D | deb, delstring, dlb, dltb, dltbs, dquote, dropafter, dropto, dtb, dtbs | 
| F | fstringreplace | 
| J | joinstring | 
| L | ljust | 
| Q | quote | 
| R | rjust, rplc | 
| S | splitnostring, splitstring, ss, stringreplace | 
| T | takeafter, taketo | 
| cut | v | cut text, by default on blanks | 
| deb | v | delete extra blanks | 
| delstring | v | delete occurrences of x from y | 
| dlb | v | delete leading blanks | 
| dltb | v | delete leading and trailing blanks | 
| dropafter | v | drop after x in y | 
| dropto | v | drop to x in y | 
| dtb | v | delete trailing blanks | 
| joinstring | v | join boxed list y with x; see splitstring | 
| ljust | v | left justify | 
| quote | v | quote text | 
| rjust | v | right justify | 
| ss | v | string search | 
| takeafter | v | take after x in y | 
| taketo | v | take to x in y | 
Character substitution.
characterpairs charsub string   '-_$ ' charsub '$123 -456 -789'
123 _456 _789Use rplc for arbitrary string replacement.
Chop delimited string to list of boxed strings.
[fd[;sd0[,sd1]]] chopstring stringreturns: list of boxed literals
 y is: delimited string
 x is: a literal or 1 or 2-item boxed list of optional delimiters.
     0{:: single literal field delimiter (fd). Defaults to ' '
 (1;0){:: (start) string delimiter (sd0). Defaults to "
 (1;1){:: end string delimiter (sd1). Defaults to "
Consecutive field delimiters indicate empty field. Field delimiters may occur within a field if the field is enclosed by string delimiters.
   ('|';'<>') chopstring '<hello|world>|4|84.3'
┌───────────┬─┬────┐
│hello|world│4│84.3│
└───────────┴─┴────┘This builds verbs to cut strings at given text and apply verbs to the pieces.
string (verb cuts n) text n=_1 up to but not including string
 n= 1 up to and including string
 n=_2 after but not including string
 n= 2 after and including string
Delete multiple leading and trailing blanks. Text is delimited by characters in x with default LF
   < 'A' dltbs ' A abc  def  Ars  A  x y  z  '
┌───────────────────┐
│Aabc  defArsAx y  z│
└───────────────────┘Double quote text.
   dquote 'Pete"s Place'
"Pete""s Place"Delete multiple trailing blanks in text. Text is delimited by characters in x with default CRLF
   < 'A' dtbs ' A abc  def  Ars  A  x y  z  '
┌──────────────────────┐
│A abc  defArsA  x y  z│
└──────────────────────┘Replace strings in file
(old;new) fstringreplace fileThis is stringreplace but with arguments reversed.
   'hello' rplc 'e';'a';'o';'owed'
hallowedSplit y by non-overlapping substrings x This is a non-overlapping variant of E.
Split y by substring x. see joinstring.
Replace characters in text string.
oldnew stringreplace textoldnew is a 2-column boxed matrix of old ,. new or a vector of same
stringreplace priority is the same order as oldnew
    ('aba';'XYZT';'ba';'+') stringreplace 'ababa'
 XYZT+
    ('ba';'+';'aba';'XYZT') stringreplace 'ababa'
 a++