Question

I have string Adult-Cruise+Lunch_label i want to remove + sign from the string. I have used preg_replace('/\s+/', '', $_option->getTitle()) to remove space from the string. how can i add code to remove + sign from the string.

Était-ce utile?

La solution

Try:

preg_replace('/[\s\+]/', '', $_option->getTitle());

Autres conseils

You could use:

preg_replace(/[+]/, "", $_option->getTitle());

This will remove only the plus sign from the string.

You canu remove + sign using javascript replace function.

var string = "Adult-Cruise+Lunch_label"; string = string.replace('+','%2B');

I think it may be work.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top