Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
a7acf425
Kaydet (Commit)
a7acf425
authored
Tem 05, 2000
tarafından
Marc-André Lemburg
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added new .isalpha() and .isalnum() methods which provide interfaces
to the new alphabetic lookup APIs in unicodectype.c.
üst
f3938f55
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
0 deletions
+66
-0
unicodeobject.c
Objects/unicodeobject.c
+66
-0
No files found.
Objects/unicodeobject.c
Dosyayı görüntüle @
a7acf425
...
...
@@ -3588,6 +3588,70 @@ unicode_isspace(PyUnicodeObject *self, PyObject *args)
return
PyInt_FromLong
(
1
);
}
static
char
isalpha__doc__
[]
=
"S.isalpha() -> int
\n
\
\n
\
Return 1 if all characters in S are alphabetic
\n
\
and there is at least one character in S, 0 otherwise."
;
static
PyObject
*
unicode_isalpha
(
PyUnicodeObject
*
self
,
PyObject
*
args
)
{
register
const
Py_UNICODE
*
p
=
PyUnicode_AS_UNICODE
(
self
);
register
const
Py_UNICODE
*
e
;
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
/* Shortcut for single character strings */
if
(
PyUnicode_GET_SIZE
(
self
)
==
1
&&
Py_UNICODE_ISALPHA
(
*
p
))
return
PyInt_FromLong
(
1
);
/* Special case for empty strings */
if
(
PyString_GET_SIZE
(
self
)
==
0
)
return
PyInt_FromLong
(
0
);
e
=
p
+
PyUnicode_GET_SIZE
(
self
);
for
(;
p
<
e
;
p
++
)
{
if
(
!
Py_UNICODE_ISALPHA
(
*
p
))
return
PyInt_FromLong
(
0
);
}
return
PyInt_FromLong
(
1
);
}
static
char
isalnum__doc__
[]
=
"S.isalnum() -> int
\n
\
\n
\
Return 1 if all characters in S are alphanumeric
\n
\
and there is at least one character in S, 0 otherwise."
;
static
PyObject
*
unicode_isalnum
(
PyUnicodeObject
*
self
,
PyObject
*
args
)
{
register
const
Py_UNICODE
*
p
=
PyUnicode_AS_UNICODE
(
self
);
register
const
Py_UNICODE
*
e
;
if
(
!
PyArg_NoArgs
(
args
))
return
NULL
;
/* Shortcut for single character strings */
if
(
PyUnicode_GET_SIZE
(
self
)
==
1
&&
Py_UNICODE_ISALNUM
(
*
p
))
return
PyInt_FromLong
(
1
);
/* Special case for empty strings */
if
(
PyString_GET_SIZE
(
self
)
==
0
)
return
PyInt_FromLong
(
0
);
e
=
p
+
PyUnicode_GET_SIZE
(
self
);
for
(;
p
<
e
;
p
++
)
{
if
(
!
Py_UNICODE_ISALNUM
(
*
p
))
return
PyInt_FromLong
(
0
);
}
return
PyInt_FromLong
(
1
);
}
static
char
isdecimal__doc__
[]
=
"S.isdecimal() -> int
\n
\
\n
\
...
...
@@ -4253,6 +4317,8 @@ static PyMethodDef unicode_methods[] = {
{
"isdecimal"
,
(
PyCFunction
)
unicode_isdecimal
,
0
,
isdecimal__doc__
},
{
"isdigit"
,
(
PyCFunction
)
unicode_isdigit
,
0
,
isdigit__doc__
},
{
"isnumeric"
,
(
PyCFunction
)
unicode_isnumeric
,
0
,
isnumeric__doc__
},
{
"isalpha"
,
(
PyCFunction
)
unicode_isalpha
,
0
,
isalpha__doc__
},
{
"isalnum"
,
(
PyCFunction
)
unicode_isalnum
,
0
,
isalnum__doc__
},
#if 0
{"zfill", (PyCFunction) unicode_zfill, 1, zfill__doc__},
{"capwords", (PyCFunction) unicode_capwords, 0, capwords__doc__},
...
...
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