![]() |
Little changes for ./system/helpers/string_helper.php - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Little changes for ./system/helpers/string_helper.php (/showthread.php?tid=30004) |
Little changes for ./system/helpers/string_helper.php - El Forum - 04-29-2010 [eluser]manuw[/eluser] Dear, I have added two small new features to ./system/helpers/string_helper.php. Code: /** and Code: /** I did not want to keep to myself ![]() The code should be self explanatory Greetz, manuw Little changes for ./system/helpers/string_helper.php - El Forum - 04-29-2010 [eluser]n0xie[/eluser] Would be easier to just extend the helper instead of hacking a system file, but other than that, nice contribution. Little changes for ./system/helpers/string_helper.php - El Forum - 04-29-2010 [eluser]hugle[/eluser] Nice contribution ![]() btw, you can name it MY_string_helper.php put it in app/helpers and when you'll load it by load->helper('string'); you'll get all core string functions and your added too ![]() so if you update someday your core, you'll won't loose your functions! good luck ![]() Little changes for ./system/helpers/string_helper.php - El Forum - 04-29-2010 [eluser]sophistry[/eluser] lovely! how about this to make it streamlined (saves a var assign): Code: function endsWith($haystack, $needle) Little changes for ./system/helpers/string_helper.php - El Forum - 04-29-2010 [eluser]manuw[/eluser] Thanks Guys. Yes. A own helper are better way =) I have a own CodeIgniter "Remix" with many function in the core (e.g. lib, helper). I add it next time. Edit: @sophistry: your "bonsai" looks better then mine ![]() Code looks good, but i dont like this coding style Code: if(x===y) return true; I'm a friend of the { } ![]() Greetz Little changes for ./system/helpers/string_helper.php - El Forum - 04-30-2010 [eluser]manuw[/eluser] The next one. Code: /** Github greetz, manuw Little changes for ./system/helpers/string_helper.php - El Forum - 04-30-2010 [eluser]danmontgomery[/eluser] http://www.php.net/manual/en/function.str-split.php Little changes for ./system/helpers/string_helper.php - El Forum - 04-30-2010 [eluser]sophistry[/eluser] str_split() is PHP5. i found this funny little thing at the php.net comments page for str_split(). it's so cute! Code: function strsplit($str, $l=1) |