Add describtion for string.rst

This commit is contained in:
xzg 2017-12-11 22:26:02 +08:00
parent 64e6f2aaca
commit 104b24c010
1 changed files with 17 additions and 0 deletions

View File

@ -56,3 +56,20 @@ String
>>> from pydu.string import strips >>> from pydu.string import strips
>>> strips('foobarfoo', 'foo') >>> strips('foobarfoo', 'foo')
'bar' 'bar'
.. py:function:: pydu.string.common_prefix(l)
Return common prefix of the stings
>>> from pydu.string import common_prefix
>>> common_prefix(['abcd', 'abc1'])
'abc'
.. py:function:: pydu.string.common_suffix(l)
Return common suffix of the stings
>>> from pydu.string import common_suffix
>>> common_suffix(['dabc', '1abc'])
'abc'