We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Plugin: Simple Multibyte String

Development and Programming

biberltd's avatar
biberltd
54 posts
16 years ago
biberltd's avatar biberltd

(programmed for EE 1.6.8)

This is a simple useless/ful plugin 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

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.