TRANSLATE is a superset of the functionality provided by REPLACE.
Syntax: TRANSLATE (STRING,FROM_STR,TO_STR) parameter
1:string, original string parameter
2:from_str, string parameter
3:to_str that needs to be replaced, used to replace
Database Programming -- Use of translate, -- translate1. translate syntaxTranslate (string, from_str, to_str)2. explanation: replace each character in the string from_str from left to right with each character corresponding to the string to_str, if
Let's take a look at the official definitions of these two functions:
String. maketrans (from, to): return a translation table suitable for passing to translate (), that will map each character in from into the character at the same position in;
I. Syntax: TRANSLATE (string, from_str, to_str) II. Purpose return: replace each character in from_str (all appearing) with a string after the corresponding character in to_str. TRANSLATE Is a superset of the functions provided by REPLACE. If
Recipe 1.9. Simplifying usage of strings 'translate Method
Recipe 1.9. Simplify the usage of the string translate method
Credit: Chris Perkins, Raymond hettinger
Problem
You often want to use the efficient string translate method, but it is
--translate functionFunction Description:Translate (str, FROM_STR, TO_STR), replacing the from_str in str with TO_STR.Translate is a superset of the functionality provided by replace. From_str and To_str are the corresponding relationships from left
Oracle uses the TRANSLATE function to replace one character in a string. How can I replace (12345, 1234, 56789) with '192*12345 '? First, replace: ChenZw> select replace ('(12345 )',',','*'),'(', ''''), ')', ''') from dual; REPLACE (RE --------------
--Character function:1, TRANSLATE (STRING,FROM_STR,TO_STR)Returns a string that replaces each character in the FROM_STR (all occurrences) with the corresponding character in To_str. Translate is a superset of the functionality provided by replace.
Application of closures in python, explanation of the translate and maketrans methods, and pythonmaketrans
Python is efficient in processing strings and has many methods. The maketrans and translate methods are used in many ways, but they often
Application of closures in python: usage of translate and maketrans, pythonmaketrans
Python is relatively efficient in processing strings, and there are many methods. The maketrans and translate methods are used in many cases. This article
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.