Ticket #6419 (new enhancement)

Opened 3 months ago

Last modified 3 months ago

improve dojo.string.trim()

Reported by: guest Owned by: peller
Priority: normal Milestone:
Component: String Version: 1.1.0
Severity: normal Keywords:
Cc:

Description

Refs #3731.

Actual dojo.string.trim() implementation comes from a Steven Levithan's post.

Steven Levithan has added to his post about trim (http://blog.stevenlevithan.com/archives/faster-trim-javascript) a faster and shorter implementation (the 12th, he calls it trim12). I think dojo.string.trim() should be updated with that implementation.

Change History

Changed 3 months ago by wolfram

If there is already movement in dojo.string.trim(), let me suggest another addition, that many of the default trim implementations (i.e. Python) have, it is passing a second parameter of which string to trim, like so:

>>> dojo.string.trim("/path/to/split/", "/")
"path/to/split"

>>> dojo.string.trim("DELIM what the heck DELIM", "DELIM")
" what the heck "

Note: See TracTickets for help on using tickets.