bug #2042032 Cannot detect PmaAbsoluteUri correctly on Windows
[phpmyadmin/madhuracj.git] / libraries / string_mb.lib.php
blob12cc0f5e18f580d800648e44f00af710efd2d382
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Specialized String Functions for phpMyAdmin
6 * Copyright 2002 Robin Johnson <robbat2@users.sourceforge.net>
7 * http://www.orbis-terrarum.net/?l=people.robbat2
9 * Defines a set of function callbacks that have a pure C version available if
10 * the "ctype" extension is available, but otherwise have PHP versions to use
11 * (that are slower).
13 * The SQL Parser code relies heavily on these functions.
15 * @version $Id$
16 * @package phpMyAdmin-String-MB
19 /**
20 * Returns length of string depending on current charset.
22 * @uses mb_strlen()
23 * @param string string to count
24 * @return int string length
25 * @access public
26 * @author nijel
27 * @todo rename to PM_STR_len()
29 function PMA_strlen($string)
31 return mb_strlen($string);
34 /**
35 * Returns substring from string, works depending on current charset.
37 * @uses mb_substr()
38 * @param string string to count
39 * @param int start of substring
40 * @param int length of substring
41 * @return int substring
42 * @access public
43 * @author nijel
44 * @todo rename to PM_STR_sub()
46 function PMA_substr($string, $start, $length = 2147483647)
48 return mb_substr($string, $start, $length);
51 /**
52 * returns postion of $needle in $haystack or false if not found
54 * @uses mb_strpos()
55 * @param string $needle
56 * @param string $haystack
57 * @return integer position of $needle in $haystack or false
59 function PMA_STR_pos($haystack, $needle, $offset = 0)
61 return mb_strpos($haystack, $needle, $offset);
64 /**
65 * returns right most postion of $needle in $haystack or false if not found
67 * @uses mb_strrpos()
68 * @param string $needle
69 * @param string $haystack
70 * @return integer position of $needle in $haystack or false
72 function PMA_STR_rPos($haystack, $needle, $offset = 0)
74 return mb_strrpos($haystack, $needle, $offset);