summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-07-30 18:23:05 (GMT)
committerGuido van Rossum <guido@python.org>1996-07-30 18:23:05 (GMT)
commitf4d0d5784ab971ee2606153eb248faa802d94d33 (patch)
treeeec1d2c79ab98ad4d537db40293f13bd6dc1bb4a /Doc
parent910a671ba0b011cbaa19ff142ab499c7c33e09bc (diff)
downloadcpython-f4d0d5784ab971ee2606153eb248faa802d94d33.zip
cpython-f4d0d5784ab971ee2606153eb248faa802d94d33.tar.gz
cpython-f4d0d5784ab971ee2606153eb248faa802d94d33.tar.bz2
Added maketrans() and optional 3rd arg to translate() (chars to delete).
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libstring.tex14
-rw-r--r--Doc/libstring.tex14
2 files changed, 22 insertions, 6 deletions
diff --git a/Doc/lib/libstring.tex b/Doc/lib/libstring.tex
index 2e79d43..7a5674e 100644
--- a/Doc/lib/libstring.tex
+++ b/Doc/lib/libstring.tex
@@ -123,6 +123,13 @@ negative, \code{len(\var{s})} is added.
Convert letters to lower case.
\end{funcdesc}
+\begin{funcdesc}{maketrans}{from, to}
+Return a translation table suitable for passing to \code{string.translate}
+or \code{regex.compile}, that will map each character in \var{from}
+into the character at the same position in \var{to}; \var{from} and
+\var{to} must have the same length.
+\end{funcdesc}
+
\begin{funcdesc}{split}{s}
Return a list of the whitespace-delimited words of the string
\var{s}.
@@ -159,10 +166,11 @@ Remove leading and trailing whitespace from the string
Convert lower case letters to upper case and vice versa.
\end{funcdesc}
-\begin{funcdesc}{translate}{s, table}
-Translate the characters from \var{s} using \var{table}, which must be
+\begin{funcdesc}{translate}{s, table\optional{, deletechars}}
+Delete all characters from \var{s} that are in \var{deletechars} (if present), and
+then translate the characters using \var{table}, which must be
a 256-character string giving the translation for each character
-value, indexed by its ordinal.
+value, indexed by its ordinal.
\end{funcdesc}
\begin{funcdesc}{upper}{s}
diff --git a/Doc/libstring.tex b/Doc/libstring.tex
index 2e79d43..7a5674e 100644
--- a/Doc/libstring.tex
+++ b/Doc/libstring.tex
@@ -123,6 +123,13 @@ negative, \code{len(\var{s})} is added.
Convert letters to lower case.
\end{funcdesc}
+\begin{funcdesc}{maketrans}{from, to}
+Return a translation table suitable for passing to \code{string.translate}
+or \code{regex.compile}, that will map each character in \var{from}
+into the character at the same position in \var{to}; \var{from} and
+\var{to} must have the same length.
+\end{funcdesc}
+
\begin{funcdesc}{split}{s}
Return a list of the whitespace-delimited words of the string
\var{s}.
@@ -159,10 +166,11 @@ Remove leading and trailing whitespace from the string
Convert lower case letters to upper case and vice versa.
\end{funcdesc}
-\begin{funcdesc}{translate}{s, table}
-Translate the characters from \var{s} using \var{table}, which must be
+\begin{funcdesc}{translate}{s, table\optional{, deletechars}}
+Delete all characters from \var{s} that are in \var{deletechars} (if present), and
+then translate the characters using \var{table}, which must be
a 256-character string giving the translation for each character
-value, indexed by its ordinal.
+value, indexed by its ordinal.
\end{funcdesc}
\begin{funcdesc}{upper}{s}