Debug v17

This commit is contained in:
Laurent Destailleur
2022-11-04 00:13:52 +01:00
parent d0a824c5e9
commit 4890a2ada3
10 changed files with 91 additions and 27 deletions

View File

@@ -3830,6 +3830,26 @@ function isValidPhone($phone)
}
/**
* Return first letters of a strings.
* Example with nbofchar=1: 'ghi' will return 'g' but 'abc def' will return 'ad'
* Example with nbofchar=2: 'ghi' will return 'gh' but 'abc def' will return 'abde'
*
* @param string $s String to truncate
* @param int $nbofchar Nb of characters to keep
* @return string Return first chars.
*/
function dolGetFirstLetters($s, $nbofchar = 1) {
$ret = '';
$tmparray = explode(' ', $s);
foreach($tmparray as $tmps) {
$ret .= dol_substr($tmps, 0, $nbofchar);
}
return $ret;
}
/**
* Make a strlen call. Works even if mbstring module not enabled
*