Guest User

Untitled

a guest
Aug 19th, 2019
69
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// <summary>
  2. /// Set string lenght required by PTX file format and upper case
  3. /// </summary>
  4. /// <param name = "_input"> Input string value</param>
  5. /// <param name = "_desireLenght"> Required string lenght</param>
  6. /// <returns></returns>
  7. public String255 setStringLength(String255 _input, int _desireLenght)
  8. {
  9. String255 outputString;
  10.  
  11. if(strLen(_input) > _desireLenght)
  12. {
  13. outputString = subStr(_input, 1, _desireLenght);
  14. }
  15. else if(strLen(_input) < _desireLenght)
  16. {
  17. int padding = _desireLenght - strLen(_input);
  18.  
  19. outputString = _input;
  20.  
  21. for(int i = 1; i<= padding; i++)
  22. {
  23. outputString = outputString + ' ';
  24. }
  25. }
  26. else
  27. {
  28. outputString = _input;
  29. }
  30.  
  31. return strUpr(outputString);
  32. }
RAW Paste Data