Advertisement
GlobalAccessSoftware

add_padding.bat

Nov 16th, 2023
585
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.51 KB | Software | 0 0
  1.  
  2.  
  3. ::: RC4
  4.  
  5. :::::::::::::::::::::::::::::::::::::::::::
  6. ::: add_padding.bat  private extension  :::
  7. :::::::::::::::::::::::::::::::::::::::::::
  8. ::: CALCULATES and Pads %str% to equal  :::
  9. ::: the correct string length needed.   :::
  10. ::: Simply by adding %addspcs% spaces.  :::
  11. :::::::::::::::::::::::::::::::::::::::::::
  12. ::: split out from runtime_display.bat  :::
  13. ::: v7.9.8.89 20221124005533  by -JpE-  :::
  14. :::::::::::::::::::::::::::::::::::::::::::
  15.  
  16.   if not defined vers set vers=v8.7.0.10 20231108073214 by -JpE-
  17.  ::: NOTE: This is merely a specific Function
  18.  ::: extension for use by runtime_display.bat (only)
  19.  
  20. ::::::::::::::::::::::::::
  21. call %strlen% leng1,l1
  22. call %strlen% leng2,line
  23. ::::::::::::::::::::::::::
  24.  
  25. :::::: NOW Calc Desired Length :::::::::
  26. set /a desired=(%leng1%-6)
  27. set /a addspcs=(%desired%-%leng2%)
  28. ::: And make it ^^^^^^^^^^^^^^^^^ longer.
  29. if %addspcs% lss 0 goto return
  30. ::::::: Unless already too ^ long ::::::
  31.  
  32. set newstr=%line%
  33. set /a nnn=(%addspcs%)
  34. set /a num=0
  35. set spc=
  36. ::: use ^ whatever char desired here. ::
  37.  
  38. :padit
  39. set /a num+=1
  40. if %num% gtr %nnn% goto checkit
  41. set newstr=%newstr%%spc%
  42. goto padit
  43.  
  44. :checkit
  45. ::::::::::::::::::::::::::
  46. call %strlen% len,newstr
  47. ::::::::::::::::::::::::::
  48. set /a ok=0
  49. set /a chk=(%leng2%+%addspcs%)
  50. if %desired% equ %chk% set /a ok+=1
  51. if %len% equ %chk% set /a ok+=2
  52. if %len% equ %desired% set /a ok+=4
  53. if %ok% lss 3 echo unverified, Using as was...
  54.  
  55. if %ok% gtr 4 set line=%newstr%
  56.  
  57. :return
  58.  
  59.  
  60.  
  61. :::  100%  -JpE-
  62.  
  63.  
  64.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement