Added string to binary function
This commit is contained in:
parent
3294d11a12
commit
fe9b75bdad
@ -7,6 +7,7 @@
|
||||
<link rel="stylesheet" href="./index.css">
|
||||
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<canvas id="glCanvas"></canvas>
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
function toBinary(text){
|
||||
var output = "";
|
||||
for (var i = 0; i < text.length; i++)
|
||||
{
|
||||
var letter = text[i].charCodeAt(0).toString(2);
|
||||
output += "0".repeat(8-letter.length) + letter;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user