mirror of
https://github.com/hexahigh/bitlong.git
synced 2025-12-11 20:15:10 +01:00
11 lines
300 B
JavaScript
11 lines
300 B
JavaScript
function stringToCustom1(str) {
|
|
return str.split('').map(function (char) {
|
|
return char.charCodeAt(0).toString(2);
|
|
}).join('-');
|
|
}
|
|
|
|
function custom1ToString(data) {
|
|
return data.split('-').map(function (bin) {
|
|
return String.fromCharCode(parseInt(bin, 2));
|
|
}).join('');
|
|
} |