I have a string like
"age = 18 || name = 'Mistic' || civilstatus = 'married' || gender = '0' "
and i need to replace "||" by "OR". I tryied following code.
System.out.println("age = 18 || name = 'Mistic' || civilstatus = 'married' || gender = '0'".replaceAll("||", "OR"));
but i got
"ORaORgOReOR OR=OR OR1OR8OR OR|OR|OR ORnORaORmOReOR OR=OR OR'ORMORiORsORtORiORcOR'OR OR|OR|OR ORcORiORvORiORlORsORtORaORtORuORsOR OR=OR OR'ORmORaORrORrORiOReORdOR'OR OR|OR|OR ORgOReORnORdOReORrOR OR=OR OR'OR0OR'OR"
What i need is
"age = 18 OR name = 'Mistic' OR civilstatus = 'married' OR gender = '0' "
How can i achieve this.
Edit I have read the question and answer of this question and it is not simiar. Because that question is about replacing string and my question is about getting unfamiliar result to my code.