सूचना: जिन गैर-व्यावसायिक प्रोजेक्ट के लिए Earth Engine को
15 अप्रैल, 2025 से पहले रजिस्टर किया गया है उन्हें ऐक्सेस बनाए रखने के लिए,
गैर-व्यावसायिक इस्तेमाल से जुड़ी ज़रूरी शर्तों की पुष्टि करनी होगी. अगर आपने 26 सितंबर, 2025 तक पुष्टि नहीं की, तो आपके ऐक्सेस को होल्ड पर रखा जा सकता है.
ee.String.replace
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
यह फ़ंक्शन, एक नई स्ट्रिंग दिखाता है. इसमें पैटर्न से मेल खाने वाले कुछ या सभी टेक्स्ट को बदल दिया जाता है.
| इस्तेमाल | रिटर्न |
|---|
String.replace(regex, replacement, flags) | स्ट्रिंग |
| आर्ग्यूमेंट | टाइप | विवरण |
|---|
यह: input | स्ट्रिंग | वह स्ट्रिंग जिसमें खोजना है. |
regex | स्ट्रिंग | मेल खाने के लिए रेगुलर एक्सप्रेशन. |
replacement | स्ट्रिंग | वह स्ट्रिंग जो मेल खाने वाली सबस्ट्रिंग की जगह इस्तेमाल की जाती है. |
flags | स्ट्रिंग, डिफ़ॉल्ट: "" | यह स्ट्रिंग, रेगुलर एक्सप्रेशन फ़्लैग के कॉम्बिनेशन के बारे में बताती है. खास तौर पर, इनमें से एक या उससे ज़्यादा फ़्लैग: 'g' (ग्लोबल मैच) या 'i' (केस को अनदेखा करें) |
उदाहरण
कोड एडिटर (JavaScript)
print(ee.String('abc-abc').replace('abc', 'X')); // X-abc
print(ee.String('abc-abc').replace('abc', 'X', 'g')); // X-X
print(ee.String('abc-abc').replace('abc', '', 'g')); // -
print(ee.String('aBc-Abc').replace('abc', 'Z', 'i')); // Z-Abc
print(ee.String('aBc-Abc').replace('abc', 'Z', 'ig')); // Z-Z
Python सेटअप करना
Python API और इंटरैक्टिव डेवलपमेंट के लिए geemap का इस्तेमाल करने के बारे में जानकारी पाने के लिए,
Python एनवायरमेंट पेज देखें.
import ee
import geemap.core as geemap
Colab (Python)
print(ee.String('abc-abc').replace('abc', 'X').getInfo()) # X-abc
print(ee.String('abc-abc').replace('abc', 'X', 'g').getInfo()) # X-X
print(ee.String('abc-abc').replace('abc', '', 'g').getInfo()) # -
print(ee.String('aBc-Abc').replace('abc', 'Z', 'i').getInfo()) # Z-Abc
print(ee.String('aBc-Abc').replace('abc', 'Z', 'ig').getInfo()) # Z-Z
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया."],[],["The `String.replace()` method replaces substrings within a string. It takes a `regex` (pattern), `replacement` string, and optional `flags`. The input string is searched for the `regex` pattern, and matched substrings are replaced by the `replacement`. Flags, like 'g' for global or 'i' for case-insensitive matching, modify the replacement behavior. The output is the modified string, the original string is not modified. The function operates the same for Javascript and Python.\n"]]