2017-11-27 20 views

答えて

1

で見つけましたNodeJS、Bufferを使用して、文字列を16進数に変換します。

Buffer.from('hello world', 'utf8').toString('hex'); 
1

あなたは以下のような機能を使用することができます。

function stringToHex(str) { 

    //converting string into buffer 
    let bufStr = Buffer.from(str, 'utf8'); 

    //with buffer, you can convert it into hex with following code 
    bufStr.toString('hex'); 

    } 

stringToHex('some string here'); 
関連する問題