Translation update done using Pootle.
[phpmyadmin/ammar_yasir.git] / libraries / string_native.lib.php
blobe70bf0b01df172ea1cd81ca941517148cf868e67
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 * @package phpMyAdmin-String-Native
18 /**
19 * Returns length of string depending on current charset.
21 * @uses strlen()
22 * @param string string to count
23 * @return int string length
24 * @access public
25 * @todo rename to PM_STR_len()
27 function PMA_strlen($string)
29 return strlen($string);
32 /**
33 * Returns substring from string, works depending on current charset.
35 * @uses substr()
36 * @param string string to count
37 * @param int start of substring
38 * @param int length of substring
39 * @return int substring
40 * @access public
41 * @todo rename to PM_STR_sub()
43 function PMA_substr($string, $start, $length = 2147483647)
45 return substr($string, $start, $length);
48 /**
49 * returns postion of $needle in $haystack or false if not found
51 * @uses strpos()
52 * @param string $needle
53 * @param string $haystack
54 * @return integer position of $needle in $haystack or false
56 function PMA_STR_pos($haystack, $needle, $offset = 0)
58 return strpos($haystack, $needle, $offset);
61 /**
62 * returns right most postion of $needle in $haystack or false if not found
64 * @uses strrpos()
65 * @param string $needle
66 * @param string $haystack
67 * @return integer position of $needle in $haystack or false
69 function PMA_STR_rPos($haystack, $needle, $offset = 0)
71 return strrpos($haystack, $needle, $offset);