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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
9be024dc
Commit
9be024dc
authored
Jun 21, 2018
by
gabrieldemarmiesse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved an example of for loop with char* to the examples directory.
parent
04780910
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 @
9be024dc
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 @
9be024dc
...
...
@@ -668,13 +668,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