Version: v0.8.1 - Beta.  We welcome contributors & feedback.

String.ensureWrap

ensureWrap($prefix, $suffix) -> string

Description

Add $prefix and $suffix to the beginning and end of the string, if both do not already exist.

'ACCEPTED'.ensureWrap('(', ')')
//= '(ACCEPTED)'

'(ACCEPTED)'.ensureWrap('(', ')')
//= '(ACCEPTED)'

See Also