| @@ 1778-1786 (lines=9) @@ | ||
| 1775 | * @param string $separator Le séparateur |
|
| 1776 | * @return string |
|
| 1777 | */ |
|
| 1778 | public function getId($string, $separator = '_') |
|
| 1779 | { |
|
| 1780 | $pos = strrpos($string, $separator); |
|
| 1781 | if ($pos === false) { |
|
| 1782 | return $string; |
|
| 1783 | } else { |
|
| 1784 | return (int)substr($string, $pos + 1); |
|
| 1785 | } |
|
| 1786 | } |
|
| 1787 | ||
| 1788 | /** |
|
| 1789 | * Fonction "inverse" de getId (depuis xxxx-99 on récupère xxxx) |
|
| @@ 1796-1804 (lines=9) @@ | ||
| 1793 | * @param string $separator Le séparateur |
|
| 1794 | * @return string |
|
| 1795 | */ |
|
| 1796 | public function getName($string, $separator = '_') |
|
| 1797 | { |
|
| 1798 | $pos = strrpos($string, $separator); |
|
| 1799 | if ($pos === false) { |
|
| 1800 | return $string; |
|
| 1801 | } else { |
|
| 1802 | return substr($string, 0, $pos); |
|
| 1803 | } |
|
| 1804 | } |
|
| 1805 | ||
| 1806 | /** |
|
| 1807 | * Renvoie un montant nul si le montant est négatif |
|