---- Original Message ----
From: vefatica
To:
[email protected]
Sent: Saturday, 2011. February 19. 22:58
Subject: [Support-t-2617] Random access to the characters in a string?
| Is there an easy way to randomly access, and change, any character
| (by position) in a string?
|
| For example, change "----" to any of "*---", "-*--", "--*-", "---*".
No easier than in C - you need to extract the parts of the string to be retained (uisng @left and @right) and concatenate the three parts (retained left substring, new substring, retained right substring). There is no equivalent to the Fortran77 statement
x[3:3]='*'
(replace the substring starting at the third character and ending at the third character with the asterisk character). A good candidate for a plugin or - better yet - a new internal function! Such a new function should allow pure insertion and pure deletion, too, simply by specifying the width of the substring to be replaced or that of the replacement substring as 0, resp. BTW, it is best to treat individual characters as one of the two special cases of strings, i.e., strings of lengths 0 and 1.
--
Steve