Quantcast
Viewing all articles
Browse latest Browse all 19

Answer by Lauri Oherd for String length in bytes in JavaScript

This function will return the byte size of any UTF-8 string you pass to it.

function byteCount(s) {    return encodeURI(s).split(/%..|./).length - 1;}

Source


Viewing all articles
Browse latest Browse all 19

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>