How to replace a Text with a pipe character

Multi tool use


How to replace a Text with a pipe character
I want to replace a String with a Pipe delimiter but it doesnt seem to work.
String tagData = "Name:Test,Code:312341,ID:4 |";
String s = "Name:sqeq,Code:34311,ID:5 |Name:qddas,Code:43134,ID:6 |Name:Test,Code:312341,ID:4 |";
i have tried:
s = s.replaceAll(tagData, "");
s = s.replace(tagData, "");
s = s.replaceFirst(tagData, "");
nothing of these Methods changed anything on my string.
s = s.replace(tagData, "");
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
s = s.replace(tagData, "");
works. What do you want?– Mạnh Quyết Nguyễn
22 secs ago