Advertisement
12Me21

conv

Jan 18th, 2017
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. commands.push(new Command("full",function(text){
  2. sendMessage(text.substr(1).toFullWidth());
  3. },"Convert message to fullwidth"));
  4.  
  5. String.prototype.toFullWidth=function() {
  6. var DO=1;
  7. var output="";
  8. for (var i=0;i<this.length;i++){
  9. var asc=this.charCodeAt(i);
  10. if (asc==96) {
  11. DO=!DO;
  12. } else if (!DO) {
  13. output+=this[i];
  14. } else if (asc==32) {
  15. output+="\u3000";
  16. } else if (asc>32&&asc<127) {
  17. output+=String.fromCharCode(asc+0xFEE0);
  18. } else {
  19. output+=this[i];
  20. }
  21. }
  22. return output;
  23. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement