开发者

How can I remove space at the end of string? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:开发者_运维问答

removing trailing space at the end of a word?

I am trying to execute a query to retrieve data but it is putting a space at the end of string and because of that it does not return any value. If I run the same query in by removing one space at the very end of the query it is executed in mqsql.

This is the query string returned by php select product_id from sp_url where url like '%etcenter.net '

the space after '%etcenter.net ' is causing the problem


http://php.net/trim

trim($variable);


The function you are looking for is called rtrim()


Probably the trim command would do what you want.

For more specifics, we'd need to see the code that creates the query string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜