The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
![]()
Does anyone know how I can make the following pre_replace also strips out whitespace BETWEEN the commas?
Right now it will trim the elements of any whitespace that may come before or after the comma. But, say, I have this: Code:
2 4 , 3 , 1 1 It won't strip out the space between the 2 and the 4, or the 1 and the 1. Code:
$str = trim(preg_replace('|\\s*(?:' . preg_quote($delimiter) . ')\\s*|', $delimiter, $str)); |
#2
|
||||
|
||||
![]() PHP Code:
PHP Code:
(not tested) |
#3
|
||||
|
||||
![]()
I meant how to add that ability to the pre_replace line I posted, so it does that also. I know how to do it by itself.
Also, your second one doesn't work for spaces. This does: PHP Code:
Now, it there any way to get the preg_replace to do that also between the commas? Right now it only works on spaces before and after the commas themselves. |
#4
|
|||
|
|||
![]()
If you would like pretty much instant answer on this go ask it on stackoverflow. I use it all the time and I always get my problems solved within 15 to 20 minutes if not sooner. Just a suggestion.
|
#5
|
||||
|
||||
![]()
I was hoping someone here might have an answer, too.
![]() I just asked on there so we will see what happens. Thanks for the tip. |
![]() |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|