MCPcopy Create free account
hub / github.com/microsoft/SandDance / utf16leToBytes

Function utf16leToBytes

docs/app/js/sanddance-app.js:114036–114048  ·  view source on GitHub ↗
(str, units)

Source from the content-addressed store, hash-verified

114034 return byteArray;
114035}
114036function utf16leToBytes(str, units) {
114037 var c, hi, lo;
114038 var byteArray = [];
114039 for(var i = 0; i < str.length; ++i){
114040 if ((units -= 2) < 0) break;
114041 c = str.charCodeAt(i);
114042 hi = c >> 8;
114043 lo = c % 256;
114044 byteArray.push(lo);
114045 byteArray.push(hi);
114046 }
114047 return byteArray;
114048}
114049function base64ToBytes(str) {
114050 return base64.toByteArray(base64clean(str));
114051}

Callers 1

ucs2WriteFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected