|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #23501 Add mb_trim(), mb_rtrim() and mb_ltrim() counterparts
Submitted: 2003-05-06 01:18 UTC Modified: 2022-04-07 14:53 UTC
Avg. Score:4.4 ± 0.9
Reproduced:30 of 31 (96.8%)
Same Version:15 (50.0%)
Same OS:15 (50.0%)
From: jc at mega-bucks dot co dot jp Assigned: ilutov (profile)
Status: Closed Package: mbstring related
PHP Version: * OS: *
Private report: No CVE-ID: None
 [2003-05-06 01:18 UTC] jc at mega-bucks dot co dot jp
I'd like to ask that a multibyte-safe version of trim() be added to PHP. If possible with this functionality:

String trim(string str, [string encoding], [string charlist])

1- automatically determine encoding of given string and remove that encoding's "whitespace". I.e if I pass an ASCII string it would act just as the current trim(), if I pass in an SJIS string it would remove whatever is considered "whitespace" for that character set (including full-width spaces).

Automatically determining the encoding of a string is not always possible, in that case the function promises only a "best guess" at the string's encoding.

2- Optional parameter that gives the string's encoding.

3- An optional list of characters to be considered "whitespace" instead of the function's built-in default list.


cool (last revision 2012-10-26 00:45 UTC by kaissa11 at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-01 20:46 UTC]
-Summary: Request a multibyte-safe version of trim() +Summary: Add mb_trim() -Package: Feature/Change Request +Package: mbstring related -Operating System: Red Hat Linux 8.0 +Operating System: * -PHP Version: 4.3.2RC2 +PHP Version: *
 [2017-10-24 01:56 UTC]
-Summary: Add mb_trim() +Summary: Add mb_trim(), mb_rtrim() and mb_ltrim() counterparts
 [2022-04-07 14:53 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: ilutov
 [2022-04-07 14:53 UTC]
This feature request has been open for a long time with no action. We're migrating away from, if this is still desired please create a new issue on GitHub.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 22 04:01:31 2024 UTC