Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. function stringToCodePointsArray(inStr) {
  2. var outArr = [];
  3. for (const symbol of inStr) {
  4. var point = symbol.codePointAt(0);
  5. outArr.push(point);
  6. // if (point !== 2028 && point !== 2029) {
  7. // outArr.push(point);
  8. // }
  9. }
  10. return outArr;
  11. }
  12.  
  13. function codePointsToString(points) {
  14. var outStr = '';
  15. for (const point of points) {
  16. outStr = outStr + String.fromCodePoint(point);
  17. }
  18. return outStr;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement