Revision: 1684
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1684&view=rev
Author:   jberanek
Date:     2010-12-09 21:58:32 +0000 (Thu, 09 Dec 2010)

Log Message:
-----------
- Added utf8_next() and utf8_strlen() as support functions in
 language.inc.

Modified Paths:
--------------
    mrbs/branches/ics_attachments/web/language.inc

Modified: mrbs/branches/ics_attachments/web/language.inc
===================================================================
--- mrbs/branches/ics_attachments/web/language.inc      2010-12-09 15:19:31 UTC 
(rev 1683)
+++ mrbs/branches/ics_attachments/web/language.inc      2010-12-09 21:58:32 UTC 
(rev 1684)
@@ -806,6 +806,29 @@
   }
 }
 
+
+// Takes a UTF-8 string and returns the string with one Unicode character
+// removed from the front
+function utf8_next($str)
+{
+  return utf8_substr($str, 1);
+}
+
+// Takes a UTF-8 string, and returns the number of _characters_ in the
+// string
+function utf8_strlen($str)
+{
+  $nchars = 0;
+
+  while ($str != "")
+  {
+    $str = utf8_next($str);
+    $nchars++;
+  }
+  return $nchars;
+}
+
+
 // Format a locale which could be xx-xX or xx_Xx or xx_XxXx (etc.) into a
 // standardised format consiting of a lower case language followed, if 
applicable,
 // by an upper case country, separated by $separator.    Typically the 
separator


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to