Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
b43c08b3
Commit
b43c08b3
authored
Jun 22, 2018
by
scoder
Committed by
GitHub
Jun 22, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2388 from gabrieldemarmiesse/test_string_13
Adding tests for "Unicode and passing strings" part 13
parents
87813c9f
9be024dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
docs/examples/tutorial/string/for_char.pyx
docs/examples/tutorial/string/for_char.pyx
+6
-0
docs/src/tutorial/strings.rst
docs/src/tutorial/strings.rst
+2
-6
No files found.
docs/examples/tutorial/string/for_char.pyx
0 → 100644
View file @
b43c08b3
cdef
char
*
c_string
=
"Hello world"
cdef
char
c
for
c
in
c_string
[:
11
]:
if
c
==
'A'
:
print
(
"Found the letter A"
)
docs/src/tutorial/strings.rst
View file @
b43c08b3
...
...
@@ -612,13 +612,9 @@ Iteration
Cython 0.13 supports efficient iteration over :c:type:`char*`,
bytes and unicode strings, as long as the loop variable is
appropriately typed. So the following will generate the expected
C code:
:
C code:
cdef char* c_string = ...
cdef char c
for c in c_string[:100]:
if c == 'A': ...
.. literalinclude:: ../../examples/tutorial/string/for_char.pyx
The same applies to bytes objects:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment