Small bug fixes convertBinaryText
This commit is contained in:
@ -428,9 +428,4 @@ function timeZone(json) {
|
||||
}
|
||||
let timeZoneStr = timeZoneValue.toString();
|
||||
return dateTimeUTC(timeZoneStr);
|
||||
}
|
||||
|
||||
// Verifie si une chaîne de caractère c'est du binaire ou non
|
||||
function isStringBin(s) {
|
||||
return s.match(/^[+\-0-1(). ]+$/g) !== null ? true : false;
|
||||
}
|
@ -190,13 +190,13 @@ $(function () {
|
||||
if(isEmptyValue(binaryTextValue)) {
|
||||
$('.results').html(emptyMessageError);
|
||||
}
|
||||
else if (isBinaryValue === true && convertIn === 'Texte') {
|
||||
else if (convertIn === 'Texte') {
|
||||
// Le replace enlève les espaces
|
||||
let textResult = binToUtf8(binaryTextValue.replace(/\s/g,''));
|
||||
|
||||
$('.results').html(textResult);
|
||||
}
|
||||
else if (isBinaryValue === false && convertIn === 'Binaire') {
|
||||
else if (convertIn === 'Binaire') {
|
||||
// Les 2 replace permettent de rajouter un espace tout les 8 bits
|
||||
let binaryResult = utf8ToBin(binaryTextValue);
|
||||
binaryResult = binaryResult.replace(/(\d{8})/g, '$1 ').replace(/(^\s+|\s+$)/,'');
|
||||
|
Reference in New Issue
Block a user