trim() as standard?

Results 1 to 2 of 2

Thread: trim() as standard?

  1. #1
    jeps0 Guest

    Default trim() as standard?

    Can anyone give me an example where trim() does any harm? For me it seems as it should be included automatically, since a trim() on a number, for an instance, does no good, but no harm either. It&#039;s a bit like the foolish idea to set valign="middle" as standard in a &#060;td&#062; (sure - can be fixed with one css line, but anyways).<BR><BR>/ jeps0

  2. #2
    J. Paul Schmidt Guest

    Default Not Healthy to Get Too Trim()

    Of course a disadvantage of Trim() is that it uses SOME system resources especially if a Trim() is not really needed.<BR><BR>Also I recently had a function that USUALLY processes NORMAL field values to show on a Web page converting double spaces to nbsp&#039;s for instance. I had initially used Trim() on the input and forgot about that. Months later I couldn&#039;t initially understand why my function didn&#039;t handle this input properly:<BR><BR>"- "<BR><BR>The above is a dash and then 6 spaces. This could be useful for a right-aligned field where the value is to be a dash instead of a percent and thus the dash would not be all the way to the right.<BR><BR>And of course the reason the function didn&#039;t convert the double spaces to nbsp&#039;s was because in the function the first line of code used Trim() on the input.<BR><BR>Best regards,<BR>-Paul<BR><BR>J. Paul Schmidt, MBA<BR>Databases on the Web<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts