@@ 1739-1747 (lines=9) @@ | ||
1736 | * |
|
1737 | * @return string |
|
1738 | */ |
|
1739 | public static function getId($string, $separator = '_') |
|
1740 | { |
|
1741 | $pos = strrpos($string, $separator); |
|
1742 | if ($pos === false) { |
|
1743 | return $string; |
|
1744 | } else { |
|
1745 | return (int)substr($string, $pos + 1); |
|
1746 | } |
|
1747 | } |
|
1748 | ||
1749 | /** |
|
1750 | * Fonction "inverse" de getId (depuis xxxx-99 on récupère xxxx) |
|
@@ 1759-1767 (lines=9) @@ | ||
1756 | * |
|
1757 | * @return string |
|
1758 | */ |
|
1759 | public static function getName($string, $separator = '_') |
|
1760 | { |
|
1761 | $pos = strrpos($string, $separator); |
|
1762 | if ($pos === false) { |
|
1763 | return $string; |
|
1764 | } else { |
|
1765 | return substr($string, 0, $pos); |
|
1766 | } |
|
1767 | } |
|
1768 | ||
1769 | /** |
|
1770 | * Renvoie un montant nul si le montant est négatif |