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

String.ensureRight

ensureRight($suffix) -> string

Description

Add $suffix to the end of the string if it does not already exist.

'100'.ensureRight('%')
//= '100%'

'100%'.ensureRight('%')
//= '100%'

See Also