News

What's happening, what's not? You are at the right spot to check all the updates abut Biber.

21Jan

Expression Engine Plugin: Simple Multibyte String

2010 posted by Can Berkol Category:

This is a simple useful plugin progrramed for Expression engine v 1.6.8 that makes use of PHP’s Multibyte String Function Library.

We generally use it to handle string case conversions within templates.

Currently, it supports 4 modification functions (mb_strtolower, mb_strtoupper, and multibyte modified versions of ucfirst and lcfirst referred respectively as mb_ucfirst and mb_lcfirst) and mb_strlen function.

You can download the plugin here.

Simply extract the pi.mb_string.php into your EE plugin folder.

There are two parameters accepted:

1- function
mb_strtolower, mb_strtoupper, mb_ucfirst, mb_lcfirst, mb_strlen

2- encoding
Accepts File encoding names such as utf-8. You can check PHP manual for more details.

*** EXAMPLES ***

# Make all characters lower case.

{exp:mb_string function=“mb_strtolower” encoding=“utf-8”}
HELLO
{/exp:mb_string}

Result: hello

# Make all characters upper case.

{exp:mb_string function=“mb_strtoupper” encoding=“utf-8”}
HelLO
{/exp:mb_string}

Result: HELLO

# Make first character lower case.

{exp:mb_string function=“mb_lcfirst” encoding=“utf-8”}
HelLO
{/exp:mb_string}

Result: helLO

# Make first character upper case.

{exp:mb_string function=“mb_ucfirst” encoding=“utf-8”}
hello
{/exp:mb_string}

Result: Hello

# Get string length.

{exp:mb_string function=“mb_ucfirst” encoding=“utf-8”}
hello
{/exp:mb_string}

Result: 5