質問

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.

役に立ちましたか?

解決

Try:

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

他のヒント

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top