1
0

cleanHTML.qsrc 662 B

1234567891011121314151617181920212223242526
  1. #cleanHTML
  2. !Removes Whitespace from between HTML tags in a string.
  3. ! Purpose is because having whitespace in writing code makes readablility,
  4. ! but the rendering engine adds extra lines at top for no reason.
  5. !
  6. ! $ARGS[0] = is the string to be cleaned up.
  7. !
  8. ! Call this as a Function to get the cleaned string returned
  9. ! example:
  10. ! *pl func('cleanHTML', $HTMLString)
  11. $HTMLString = $ARGS[0]
  12. :cleanHTMLloop
  13. $BadStr = STRFIND($HTMLString, '\>\s+\<', 0)
  14. if $BadStr ! "":
  15. $HTMLString = REPLACE( $HTMLString , $BadStr , "><" )
  16. jump 'cleanHTMLloop'
  17. end
  18. $result = $HTMLString
  19. killvar '$HTMLString'
  20. killvar '$BadStr'
  21. --- cleanHTML ---------------------------------