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
0b3f9512
Kaydet (Commit)
0b3f9512
authored
Agu 09, 1996
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added capwords, splitx, and optional 3rd argument to split/splitx.
üst
7a7d5d8f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
10 deletions
+42
-10
libregsub.tex
Doc/lib/libregsub.tex
+21
-5
libregsub.tex
Doc/libregsub.tex
+21
-5
No files found.
Doc/lib/libregsub.tex
Dosyayı görüntüle @
0b3f9512
...
...
@@ -7,6 +7,7 @@ regular expressions (see built-in module \code{regex}).
Warning: these functions are not thread-safe.
\renewcommand
{
\indexsubitem
}{
(in module regsub)
}
\begin{funcdesc}
{
sub
}{
pat
\,
repl
\,
str
}
Replace the first occurrence of pattern
\var
{
pat
}
in string
\var
{
str
}
by replacement
\var
{
repl
}
. If the pattern isn't found,
...
...
@@ -23,13 +24,28 @@ when not adjacent to a previous match, so e.g.
\code
{
gsub('', '-', 'abc')
}
returns
\code
{
'-a-b-c-'
}
.
\end{funcdesc}
\begin{funcdesc}
{
split
}{
str
\,
pat
\optional
{
\,
retain
}}
\begin{funcdesc}
{
split
}{
str
\,
pat
\optional
{
\,
maxsplit
}}
Split the string
\var
{
str
}
in fields separated by delimiters matching
the pattern
\var
{
pat
}
, and return a list containing the fields. Only
non-empty matches for the pattern are considered, so e.g.
\code
{
split('a:b', ':*')
}
returns
\code
{
['a', 'b']
}
and
\code
{
split('abc', '')
}
returns
\code
{
['abc']
}
.
If the optional
\var
{
retain
}
argument is true, the separators are also
inserted in the list, so e.g.
\code
{
split('a:::b', ':*', 1)
}
returns
\code
{
['a', ':::', 'b']
}
.
\code
{
split('abc', '')
}
returns
\code
{
['abc']
}
. The
\var
{
maxsplit
}
defaults to 0. If it is nonzero, only
\var
{
maxsplit
}
number of splits
occur, and the remainder of the string is returned as the final
element of the list.
\end{funcdesc}
\begin{funcdesc}
{
splitx
}{
str
\,
pat
\optional
{
\,
maxsplit
}}
Split the string
\var
{
str
}
in fields separated by delimiters matching
the pattern
\var
{
pat
}
, and return a list containing the fields as well
as the separators. For example,
\code
{
splitx('a:::b', ':*')
}
returns
\code
{
['a', ':::', 'b']
}
. Otherwise, this function behaves the same
as
\code
{
split
}
.
\end{funcdesc}
\begin{funcdesc}
{
capwords
}{
s
\optional
{
\,
pat
}}
Capitalize words separated by optional pattern
\var
{
pat
}
. The default
pattern uses any characters except letters, digits and underscores as
word delimiters. Capitalization is done by changing the first
character of each word to upper case.
\end{funcdesc}
Doc/libregsub.tex
Dosyayı görüntüle @
0b3f9512
...
...
@@ -7,6 +7,7 @@ regular expressions (see built-in module \code{regex}).
Warning: these functions are not thread-safe.
\renewcommand
{
\indexsubitem
}{
(in module regsub)
}
\begin{funcdesc}
{
sub
}{
pat
\,
repl
\,
str
}
Replace the first occurrence of pattern
\var
{
pat
}
in string
\var
{
str
}
by replacement
\var
{
repl
}
. If the pattern isn't found,
...
...
@@ -23,13 +24,28 @@ when not adjacent to a previous match, so e.g.
\code
{
gsub('', '-', 'abc')
}
returns
\code
{
'-a-b-c-'
}
.
\end{funcdesc}
\begin{funcdesc}
{
split
}{
str
\,
pat
\optional
{
\,
retain
}}
\begin{funcdesc}
{
split
}{
str
\,
pat
\optional
{
\,
maxsplit
}}
Split the string
\var
{
str
}
in fields separated by delimiters matching
the pattern
\var
{
pat
}
, and return a list containing the fields. Only
non-empty matches for the pattern are considered, so e.g.
\code
{
split('a:b', ':*')
}
returns
\code
{
['a', 'b']
}
and
\code
{
split('abc', '')
}
returns
\code
{
['abc']
}
.
If the optional
\var
{
retain
}
argument is true, the separators are also
inserted in the list, so e.g.
\code
{
split('a:::b', ':*', 1)
}
returns
\code
{
['a', ':::', 'b']
}
.
\code
{
split('abc', '')
}
returns
\code
{
['abc']
}
. The
\var
{
maxsplit
}
defaults to 0. If it is nonzero, only
\var
{
maxsplit
}
number of splits
occur, and the remainder of the string is returned as the final
element of the list.
\end{funcdesc}
\begin{funcdesc}
{
splitx
}{
str
\,
pat
\optional
{
\,
maxsplit
}}
Split the string
\var
{
str
}
in fields separated by delimiters matching
the pattern
\var
{
pat
}
, and return a list containing the fields as well
as the separators. For example,
\code
{
splitx('a:::b', ':*')
}
returns
\code
{
['a', ':::', 'b']
}
. Otherwise, this function behaves the same
as
\code
{
split
}
.
\end{funcdesc}
\begin{funcdesc}
{
capwords
}{
s
\optional
{
\,
pat
}}
Capitalize words separated by optional pattern
\var
{
pat
}
. The default
pattern uses any characters except letters, digits and underscores as
word delimiters. Capitalization is done by changing the first
character of each word to upper case.
\end{funcdesc}
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