用已字符串包围另一字符串。
- Source:
Example
str.surround('foo', 'ab') // 'abfooab'
str.surround('foo', 1) // '1foo1'
str.surround('foo', '') // 'foo'
str.surround(123, 'ab') // 'ab123ab'
str.surround(123, 4) // '41234'
str.surround('', 2) // '22'
Parameters:
Name | Type | Description |
---|---|---|
str |
String | 被包围的字符串 |
wrap |
String | 用来包围的字符串 |
Returns:
包围后的字符串
- Type
- String