summaryrefslogtreecommitdiff
path: root/docs/examples/tutorial/string/decode_cpp_string.pyx
blob: 52861c209cb646e522aeb0e7ec7fa4184073644e (plain)
1
2
3
4
5
6
7
8
9
10
# distutils: language = c++

from libcpp.string cimport string

def get_ustrings():
    cdef string s = string(b'abcdefg')

    ustring1 = s.decode('UTF-8')
    ustring2 = s[2:-2].decode('UTF-8')
    return ustring1, ustring2