Stringreplace on all occurrences

Asked

Viewed 58 times

0

I’d like to replace all the \ for / on my Edit, but it only works for the first occurrence with the following code:

Edit1.text := '"'+ StringReplace(Edit1.text, '\', '/', []) + '"';

How to replace all?

Taking advantage, the result would be something like

"C:/Users/Usuario/Documents/BD Demo/Alta Cruz/AltaCruz_c/"

how to withdraw the last / after the Altacruz_c ?

1 answer

2


You must pass the rfReplaceAll flag as stated in documentation

Stringreplace(Edit1.text, ' ', '/', [rfReplaceAll]);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.