Part of the EllisLab Network
   
 
trim_slashes()
Posted: 14 February 2007 12:45 PM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  248
Joined  02-10-2007

Found in string_helper.php at about line 45:

function trim_slashes($str)
{
    
return preg_replace("|^/*(.+?)/*$|", "\\1", $str);
}

What about ...

function trim_slashes($str)
{
    
return trim($str, '/');
}

Or am I just nitpicking again? wink

 Signature 

Kohana rocks!

Profile
 
 
Posted: 14 February 2007 07:00 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  486
Joined  09-14-2006

I agree and it’s not nitpicking. There are many places throughout CI that use regex when it’s not necessary. Hopefully we can start to weed them out one day.

 Signature 

Code Igniter 1.5.4 / CentOS 5 / PHP 5.2.3 / Apache 2.2.2 / MySQL 5.0.27

Profile
 
 
Posted: 15 February 2007 12:03 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  19
Joined  12-07-2006

Oops, nevermind. I misread your suggested code.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 66414 Total Logged-in Users: 31
Total Topics: 84753 Total Anonymous Users: 0
Total Replies: 454835 Total Guests: 243
Total Posts: 539588    
Members ( View Memberlist )
Newest Members:  paulevansbyrooNirCalexmuellerkizerdrixcaptainredmuffquinodligtharttechsivamDjordje