summaryrefslogtreecommitdiff
path: root/docs/examples/tutorial/string/decode_cpp_string.pyx
blob: 8f1d01af827e9e1a7f00ab9daae3a9e95e4d59e2 (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