Advertisement
Guest User

Untitled

a guest
May 16th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///string_make_width(string,length)
  2.  
  3. /*
  4. **  Usage:
  5. **      string_make_width(string,length)
  6. **
  7. **  Given:
  8. **      string      A string
  9. **      length      The length in pixels to make the string
  10. **
  11. **  Returns:
  12. **      The string fit into the specified width.
  13. */
  14.  
  15. var str, length, word, ret, ret2;
  16. str = argument[0] + " "
  17. length = string_count(" ",str)
  18. ret = ""
  19. for (var i = 0; i < length; i++) {
  20.  
  21.     word = string_copy(str,1,string_pos(" ",str) - 1);
  22.     str = string_copy(str,string_pos(" ",str) + 1,string_length(str));
  23.     ret2 = ret + word + " ";
  24.     if (string_width(ret2) > argument[1]) {
  25.    
  26.         ret2 = ret + "#" + word + " ";
  27.     }
  28.     ret = ret2;
  29. }
  30. return ret;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement