Skip to content

Implement method CppStringT::strip() #51

@schmouk

Description

@schmouk

" str.strip([chars])

Return a copy of the string with the leading and trailing characters removed. The chars argument is a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to removing whitespace. The chars argument is not a prefix or suffix; rather, all combinations of its values are stripped:
>>>

' spacious '.strip()
'spacious'

'www.example.com'.strip('cmowz.')
'example'

The outermost leading and trailing chars argument values are stripped from the string. Characters are removed from the leading end until reaching a string character that is not contained in the set of characters in chars. A similar action takes place on the trailing end. For example:

comment_string = '#....... Section 3.2.1 Issue #32 .......'

comment_string.strip('.#! ')
'Section 3.2.1 Issue #32'"

Metadata

Metadata

Assignees

Labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions