From 74ccb78b4ab489ef6a89631dc34f5bd2cde6f99e Mon Sep 17 00:00:00 2001 From: Prodesire Date: Wed, 13 Dec 2017 22:01:14 +0800 Subject: [PATCH] format string doc --- docs/string.rst | 80 ++++++++++++++++++++++++------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/docs/string.rst b/docs/string.rst index ab45a95..4b4d9b4 100644 --- a/docs/string.rst +++ b/docs/string.rst @@ -3,73 +3,73 @@ String .. py:function:: pydu.string.safeunicode(obj, encoding='utf-8') - Converts any given object to unicode string. + Converts any given object to unicode string. - >>> from pydu.string import safeunicode - >>> safeunicode('hello') - u'hello' - >>> safeunicode(2) - u'2' - >>> safeunicode('\xe4\xb8\xad\xe6\x96\x87') - u'中文' + >>> from pydu.string import safeunicode + >>> safeunicode('hello') + u'hello' + >>> safeunicode(2) + u'2' + >>> safeunicode('\xe4\xb8\xad\xe6\x96\x87') + u'中文' .. py:function:: pydu.string.safeencode(obj, encoding='utf-8') - Converts any given object to encoded string (default: utf-8). + Converts any given object to encoded string (default: utf-8). - >>> from pydu.string import safeencode - >>> safeencode('hello') - 'hello' - >>> safeencode(2) - '2' - >>> safeencode(u'中文') - '\xe4\xb8\xad\xe6\x96\x87' + >>> from pydu.string import safeencode + >>> safeencode('hello') + 'hello' + >>> safeencode(2) + '2' + >>> safeencode(u'中文') + '\xe4\xb8\xad\xe6\x96\x87' .. py:function:: pydu.string.lstrips(text, remove) - Removes the string ``remove`` from the left of ``text``. + Removes the string ``remove`` from the left of ``text``. - >>> from pydu.string import lstrips - >>> lstrips('foobar', 'foo') - 'bar' - >>> lstrips('FOOBARBAZ', ['FOO', 'BAR']) - 'BAZ' - >>> lstrips('FOOBARBAZ', ['BAR', 'FOO']) - 'BARBAZ' + >>> from pydu.string import lstrips + >>> lstrips('foobar', 'foo') + 'bar' + >>> lstrips('FOOBARBAZ', ['FOO', 'BAR']) + 'BAZ' + >>> lstrips('FOOBARBAZ', ['BAR', 'FOO']) + 'BARBAZ' .. py:function:: pydu.string.rstrips(text, remove) - Removes the string ``remove`` from the right of ``text``. + Removes the string ``remove`` from the right of ``text``. - >>> from pydu.string import rstrips - >>> rstrips('foobar', 'bar') - 'foo' + >>> from pydu.string import rstrips + >>> rstrips('foobar', 'bar') + 'foo' .. py:function:: pydu.string.strips(text, remove) - Removes the string ``remove`` from the both sides of ``text``. + Removes the string ``remove`` from the both sides of ``text``. - >>> from pydu.string import strips - >>> strips('foobarfoo', 'foo') - 'bar' + >>> from pydu.string import strips + >>> strips('foobarfoo', 'foo') + 'bar' .. py:function:: pydu.string.common_prefix(l) - Return common prefix of the stings + Return common prefix of the stings - >>> from pydu.string import common_prefix - >>> common_prefix(['abcd', 'abc1']) - 'abc' + >>> from pydu.string import common_prefix + >>> common_prefix(['abcd', 'abc1']) + 'abc' .. py:function:: pydu.string.common_suffix(l) - Return common suffix of the stings + Return common suffix of the stings - >>> from pydu.string import common_suffix - >>> common_suffix(['dabc', '1abc']) - 'abc' \ No newline at end of file + >>> from pydu.string import common_suffix + >>> common_suffix(['dabc', '1abc']) + 'abc' \ No newline at end of file