Strings in Javascript | chai aur #javascript
Summary
TLDRThe video script is an in-depth exploration of JavaScript strings, focusing on modern syntax and practical applications. It covers basic concepts like declaring and concatenating strings, introduces template literals for cleaner code, and delves into string methods such as trim, replace, and split. The instructor emphasizes the importance of understanding string manipulation for web development, providing examples and tips for effective learning. The script promises regular content for subscribers interested in enhancing their JavaScript skills.
Takeaways
- 😀 The video is a tutorial focused on modern JavaScript string manipulation techniques and concepts.
- 📝 The instructor emphasizes the importance of understanding basic concepts like 'stack', 'hit memory', 'object', and 'error' for effective coding.
- 🎯 The video covers string interpolation, a modern syntax for embedding variables directly within strings, which is considered more reliable and modern.
- 🔍 It discusses the use of template literals with placeholders and how they can be used to inject variables seamlessly into strings.
- 👀 The script mentions the importance of understanding string methods and properties, such as 'length', for better string handling in JavaScript.
- ✂️ The 'slice' method is introduced, which allows for the extraction of parts of a string, including the use of negative values for reverse indexing.
- 🔄 The 'split' method is explained, which is used to break a string into an array of substrings based on a specified separator.
- 🌐 The video touches on string methods like 'trim', 'replace', and 'toLowerCase', which are useful for sanitizing and manipulating strings.
- 📚 The instructor recommends reading the MDN documentation for a comprehensive understanding of all string methods and their applications.
- 💻 The video includes practical examples and uses the console to demonstrate the concepts being taught, providing a clear understanding of how strings work in JavaScript.
- 🔑 The script concludes with an encouragement to practice string manipulation and to follow the channel for more content on modern coding techniques.
Q & A
What is the main topic of the video script?
-The main topic of the video script is about modern JavaScript string manipulation and the various methods available for handling strings in a modern web development context.
What does the script mention about the syntax for declaring strings in JavaScript?
-The script mentions that in JavaScript, you can declare strings using either single quotes or double quotes, and there is no difference between the two in terms of syntax.
How does the script introduce the concept of string interpolation?
-The script introduces string interpolation as a modern syntax feature that allows developers to inject variables directly into strings using template literals, denoted by backticks and placeholders within the string.
What is the purpose of the 'length' property in strings as discussed in the script?
-The 'length' property in strings, as discussed in the script, is used to determine the number of characters in a string, which is an important feature for manipulating and accessing string content.
How does the script explain the use of string methods like 'slice'?
-The script explains the use of the 'slice' method in strings as a way to extract a part of a string. It also mentions the ability to use negative values with 'slice' to start the extraction from the end of the string.
What is the 'trim' method mentioned in the script, and what does it do?
-The 'trim' method mentioned in the script is used to remove whitespace from both ends of a string, which is particularly useful when dealing with user input or formatting in web development.
How does the script describe the process of string concatenation?
-The script describes string concatenation as a process where multiple strings or variables can be combined into a single string using the plus (+) symbol in JavaScript.
What is string interpolation as discussed in the video script?
-String interpolation, as discussed in the video script, refers to embedding variables and expressions within a string literal, allowing for dynamic content insertion directly into the string.
What are some of the string methods mentioned in the script that can be used to manipulate strings?
-Some of the string methods mentioned in the script include 'slice', 'trim', 'replace', 'split', and methods for accessing string properties like 'length'.
How does the script suggest using the 'replace' method in strings?
-The script suggests using the 'replace' method to search for specific patterns or substrings within a string and replace them with different text, which is useful for various string manipulation tasks.
What is the 'split' method used for in strings, as mentioned in the script?
-The 'split' method, as mentioned in the script, is used to divide a string into an array of substrings based on a specified separator, which can be a character or a string.
Outlines
😀 Introduction to Modern JavaScript String Concepts
The speaker welcomes the audience to a session on tea and court, apologizes for being late, and promises regular content. They introduce the topic of modern JavaScript string manipulation, emphasizing the importance of understanding data types like stack memory and hit memory. The speaker encourages the audience to be familiar with terms like 'object' and 'error'. They begin with basic string operations in JavaScript, such as declaring strings with single or double quotes and concatenating strings using the plus symbol. The speaker also mentions the use of variables to store strings and the importance of understanding modern coding practices.
😇 Exploring JavaScript String Objects and Methods
The speaker delves into the concept of strings as objects in JavaScript, highlighting the ability to access properties and methods associated with them. They discuss how strings can be declared using the 'new String' syntax and how this creates a string object with various methods and properties. The speaker demonstrates accessing string properties like 'length' and methods such as 'charAt', 'includes', and 'indexOf'. They also touch on the topic of string immutability, showing that methods that appear to modify strings actually return new string instances.
😉 Advanced String Manipulation Techniques
The speaker introduces advanced string manipulation techniques, such as using the 'slice' method to extract parts of a string and the 'replace' method to substitute characters or patterns within a string. They explain the syntax and functionality of these methods, providing examples to illustrate their use. The speaker also discusses the importance of understanding how to break strings into parts and sanitize them, hinting at the usefulness of these skills in web development and programming.
🎓 Utilizing String Methods for Cleaning and Formatting
The speaker focuses on the practical applications of string methods for cleaning and formatting data, such as removing unnecessary spaces and replacing unwanted characters. They demonstrate the 'trim' method to remove whitespace from the beginning and end of a string and the 'replace' method to substitute specific characters or patterns. The speaker also mentions the importance of understanding browser compatibility and the use of regular expressions for more complex string manipulation tasks.
🛠 Practical Examples of String Manipulation
The speaker provides practical examples of string manipulation, such as splitting strings into arrays using the 'split' method and converting strings to different cases using methods like 'toLowerCase' and 'toUpperCase'. They discuss the importance of these techniques in tasks like URL manipulation and data cleaning. The speaker also encourages the audience to explore the extensive documentation available for JavaScript strings to discover new methods and improve their coding skills.
📚 Conclusion and Encouragement for Further Learning
In the concluding part, the speaker summarizes the importance of understanding and practicing string manipulation in JavaScript. They encourage the audience to continue learning about strings, to explore the documentation, and to practice these concepts to improve their coding abilities. The speaker also invites the audience to subscribe and share the video, expressing their enjoyment in creating the content and looking forward to the next session.
Mindmap
Keywords
💡String
💡Interpolation
💡Prototype
💡Methods
💡Trim
💡Replace
💡Slice
💡Concatenation
💡Template Literals
💡Data Types
💡Modern Syntax
Highlights
Introduction to modern JavaScript string concepts and their importance in coding.
Explanation of basic string syntax and operations like concatenation using the plus symbol.
Discussion on declaring strings with single or double quotes and their equivalence in JavaScript.
Introduction to string interpolation as a modern way to inject variables into strings.
Demonstration of string interpolation with variables using template literals.
Explanation of the backtick (``) syntax for creating strings in modern JavaScript.
Highlighting the use of string methods like `length` and their availability on the prototype.
Introduction to string object properties and methods, emphasizing their usefulness in modern development.
Explanation of how strings are treated as objects in JavaScript with properties like `length`.
Discussion on accessing string methods directly without the need for constructor syntax.
Introduction to string methods like `toLowerCase`, `toUpperCase`, and their practical applications.
Explanation of how to use string methods to manipulate case and whitespace in strings.
Demonstration of using the `trim` method to remove unnecessary whitespace from strings.
Introduction to the `replace` method for string manipulation and its use cases.
Explanation of how to use the `slice` method for substring extraction with both positive and negative indices.
Discussion on the `split` method for breaking strings into arrays based on a delimiter.
Highlighting the importance of understanding string methods for effective front-end and back-end development.
Recommendation to practice string manipulation and explore the extensive documentation for deeper understanding.
Emphasis on the modern syntax and methods for strings, advising against outdated practices.
Encouragement to follow and engage with the content for continuous learning and updates on JavaScript strings.
Transcripts
हान जी स्वागत है आप सभी का चाय और कोर्ट
में काफी लेट हो गया आज लेकिन वीडियो तो
बिल्कुल बनाएंगे और आपके लिए कंटेंट भी
रेगुलर लाएंगे क्योंकि आपने ऑलरेडी
सब्सक्राइब कर दिया है तो इस वीडियो में
हम और आगे थोड़ा सा प्रोसीड करते हैं बहुत
ही जल्द हम कंडीशनर और वो सभी देखेंगे बट
थोड़ा सा मैं आपको और डाटा टाइप्स के बारे
में स्ट्रांग करना चाहता हूं ताकि जिससे
हम जैसे ही हम इफ लक या फिर लूप्स यह सब
स्टार्ट करें तो हम बहुत ही स्पीड ली मूव
कर पाए क्योंकि आपके बेसिक क्लियर है आपको
पता है स्टैक क्या है हिट मेमोरी क्या है
कौन सा वाला ऑब्जेक्ट है कौन सा वाला एरर
है ये सब आपके पास डिटेल में रहे तो इस
वीडियो में हम बात करेंगे स्ट्रिंग्स के
बारे में स्ट्रिंग बहुत ही इंटरेस्टिंग
कॉन्सेप्ट है किस तरह से आप अपने कोड को
मॉडर्नाइज लिख सकते हैं क्योंकि स्ट्रिंग
आपने काफी बार पहले भी पढ़ा होगा
जावास्क्रिप्ट में कोई इतना कोई खास नहीं
है लेकिन जिस तरह से अगर आप आज की डेट में
कोड लिख रहे हैं तो आपको स्ट्रिंग का जो
मॉडर्न सेंटेंस है वही उसे करना चाहिए तो
इस वीडियो में उसी के बारे में बात करूंगा
मैं आपसे तो चलिए शुरू करते हैं हमारी कोड
फाइल के अंदर एक नई फाइल मैंने ऐड कर दिया
जीरो फाइव स्ट्रिंग क्योंकि हम स्ट्रिंग
के अंदर इसके अंदर बात करेंगे आपको मैं
कंसोल के अंदर भी स्ट्रिंग दिखाऊंगा ताकि
आपको एक्चुअली में डिटेल पता लगे स्ट्रिंग
का है क्या चीज तो सबसे पहले हम कंसोल के
अंदर ही चलते हैं और बेसिक आपको दिखाता
हूं तो इंस्पेक्टर पे क्लिक करिए और कंसोल
में जाइए तो ये हमारा कंसोल है तो आप
देखेंगे की स्ट्रिंग सिंगल को से भी डिनोट
करते हैं और डबल को से भी करते हैं जावा
स्क्रिप्ट के अंदर इसके अंदर कोई ऐसा
डिफरेंस नहीं है आप चाहे तो सिंगल से करिए
डबल से करिए कुछ भी नहीं है अब सबसे पहला
जो आप स्ट्रिंग का देखेंगे वो देखेंगे की
डबल कोट्स में स्ट्रिंग आपने डिक्लेयर कर
दी है और दो स्ट्रिंग्स को ऐड करने के लिए
इस तरह से प्लस सिंबल उसे होता है और आपने
यहां पे लिख दिया हेलो वर्ल्ड ठीक है लिख
देते हैं कोई इशू नहीं है और दोनों
स्ट्रिंग एक साथ अटैच हो गई है कॉन्टैक्ट
हो गई है ये सिंटेक्स है ठीक है कोई
प्रॉब्लम नहीं है बट इतना बेसिक हो गया
अभी हम एक बार मूव करते हैं यहां पे की ये
तो हो गया हमारा बेसिक स्ट्रिंग लेकिन जब
आप प्रोग्राम में लिखेंगे स्ट्रिंग्स को
तब आप वैरियेबल्स में इसको लेंगे जैसे फॉर
एग्जांपल आपने कहा नाम तो नाम हो गया मेरा
यहां पे नाम लिख दिया मैंने ठीक है अब
आपके पास और भी डाटा टाइप्स आएंगे अरे भी
आएंगे नंबर्स भी आएंगे boliyans भी आएगी
इस तरह के और भी वैल्यू आएगी जैसे फॉर
एग्जांपल यहां पे मैं लिख देता हूं की
मैंने कुछ
रैप अकाउंट की मेरे गेट हफ्ते कितने
रिपोजिटरी है जैसे रिज्यूम रिज्यूम करते
हैं की हम 50 रिपोजिटरीज है आई थिंक
ज्यादा ही होगी इससे बट ठीक है अब इन
दोनों को मुझे अगर कंकेट करना है तो अभी
हमने देखा की कंसों लॉक के अंदर हम कर
सकते हैं जिस तरह से अभी हमने किया है तो
सिंपली आप क्या करेंगे यहां पे नेम और
इसको कंकेट कर देंगे सिंपली
रैप अकाउंट के साथ
रेप काउंट और इसके साथ-साथ आप कुछ और भी
कंकेट कर सकते हैं ये जो स्क्रैच हुआ है
नेम इस पर ध्यान मत दीजिए कई बार ये
लेंटिंग फीचर्स है टाइप स्क्रिप्ट वगैरह
का वो सब दे देता है लेकिन इसके साथ आप और
भी ऐड कर सकते हैं जैसे की वैल्यू और
समथिंग जो भी आपको ऐड करना है इसको एक बार
मैं रन करके आपको दिखाता हूं बहुत इजी है
तो यहां पर
लिखना था वो ए गया है अब ये जो सिंटेक्स
आप सबसे ज्यादा देखेंगे की आपको कुछ भी
नहीं करना है कोई भी वेरिएबल करना है तो
प्लस प्लस लिख के कर दीजिए कॉमन लगा के कर
दीजिए ये सिंटेक्स मुझे बिल्कुल भी कहीं
से भी अच्छा नहीं लगता है इसके थ्रू मैं
आज की डेट में किसी को भी रिकमेंड नहीं
करता हूं की आप इस सिंटेक्स को उसे करें
क्योंकि ये थोड़ा सा अपडेट है मॉडर्न डेज़
में इस तरह से कोई भी लिखना पसंद नहीं
करता है अगर आज की डेट में आपको लिखना है
तो आप उसे करेंगे बैक टेक्स्ट बैक टेक्स्ट
उसे करने का फायदा क्या है यहां पे आता है
स्ट्रिंग इंटरपोलेशन नाम काफी परिसर है बट
है क्या की आप बनाते हैं प्लेस होल्डर्स
उनके अंदर जो भी वारी है आप डायरेक्टली
वहां पर इंजेक्ट कर सकते हैं जैसे
सपोर्ट करिए हेलो
माय नाम इसे और उसके बाद आपको यहां पर
वेरिएबल इंजेक्ट करना है तो आप डॉलर साइन
उसे करिए यहां पर लिखकर और लिखते जाइए
ज्यादा रिलायबल है तो यहां पे आके मैं
सिंपली नाम फुल कर दिया यहां पे आके मैंने
रैप अकाउंट फिल कर दिया तो यह जो सिंटेक्स
कंपेरटिवली मुझे बटर लगता है रेड लगता है
और आप भी जब बैक हैंड डेवलपमेंट वगैरा
करेंगे तो ज्यादातर इसी को उसे करेंगे
रिजल्ट में कोई डिफरेंस नहीं है बट ये
थोड़ा सा मॉडर्न वेयर सिंटेक्स का जिसको
स्ट्रिंग इंटरपोलेशन बोला जाता है अब इसका
फायदा क्या है की आप बहुत सारी चीज ऑन डी
गोभी कर सकते हैं जैसे स्ट्रिंग है नाम है
तो मेरे को कुछ मैथर्ड के अंदर करना है
जैसे आर तू अपार केस है जो भी मुझे लगाना
है तो मैं यहां पे इजीली इसको उसे कर सकता
हूं तो वो भी आप कर सकते हैं अच्छा ये तो
हो गया बेसिक
कॉन्सेप्ट है इंटरेस्टिंग कैसे बताता हूं
आपको की जैसे सपोस करिए मैंने यहां पर कहा
की मुझे एक स्ट्रिंग बताइए तो मैंने कहा
की
डॉट लोग और मैंने यहां पर स्ट्रिंग को
प्रिंट कर
हेलो
तो आपके पास यहां पर हेलो प्रिंट हो गया
स्ट्रिंग को डिक्लेयर करना है एक और तरीका
भी है जैसे की सपोर्ट करिए मैं यहां पर
देता हूं गेम नाम सपोज करिए मैं कोई गेम
नाम या डिस्कार्ड नाम चीज कर रहा हूं तो
आप एक और सिंटेक्स उसे कर सकते हैं जिसके
अंदर न्यू कीवर्ड उसे करते हैं तो आप
ऑब्जेक्ट उसे करते हैं जप के और यहां पे
अपने स्ट्रिंग का उसे कर और उसके
कंस्ट्रक्टर के अंदर आपने नाम दिया जैसे
मैंने दिया हितेश क तो ये नाम हो गया
हमारे पास वैल्यू से ही आएगी जैसे
स्ट्रिंग डिक्लेयर करते हैं कोई खास
डिफरेंस नहीं है बिहाइंड डी सीन ये भी
आपका ऑब्जेक्टिव इन्वोक कर रहा है तो इसी
तरह से हो जाता है लेकिन इंटरेस्टिंग चीज
यहां पे ये है की मैं इस वेरिएबल को कॉपी
करता हूं और यहां पे आपको कुछ इंटरेस्टिंग
चीज दिखाता हूं इसको जैसे मैंने रन कर अब
मैंने इसको बोला की गेम नाम बताओ मुझे
सॉरी
[संगीत]
आपके पास आया है वैल्यू और जैसे मैंने
इसको ओपन कर तो आप देख सकते हैं जीरो
पोजीशन ह है अभी जो पोजीशन है इससे यह मत
कंफ्यूज करेगा की अरे स्ट्रिंग एक
ऑब्जेक्ट है यहां पे आप टाइप भी देखेंगे
स्ट्रिंग का तो वो भी देख सकते हैं ये की
वैल्यू पैर से जीरो इसकी की है वैल्यूज की
है तो ऑटोमेटेकली ये आपके पास ए जाता है
अब इसमें सबसे इंटरेस्टिंग क्या है की
आपके पास एक लेंथ प्रॉपर्टी आपको मिलती है
प्लस आपके पास बहुत सारे और मैथर्ड भी
मिलते हैं जो की प्रोटोटाइप के अंदर है हम
आगे जाके वीडियोस में प्रोडक्ट आई
प्रोटोटाइप इन्हेरिटेंस ये भी सब देखेंगे
और अभी मैं जैसे इसको ओपन करता हूं तो आप
देख सकते हैं कितने सारे मैथर्ड अवेलेबल
हैं सारे मेथड तो ऑब्वियस सी बात है हम
डिस्कस नहीं कर सकते एक वीडियो में बट देख
सकते हैं आप यहां पर एंड्स की कंस्ट्रक्टर
भी है कंकेट भी है कैरक्टर आते भी है
पद एंड कितने सारे पैसे हैं जो मैंने कभी
उसे भी नहीं करें बट आपके पास बहुत मेथड
मिलते हैं इन मेथड को मास्टर करना ही
एक्चुअली में स्ट्रिंग के बारे में पढ़ाई
करने का सारा का सारा हमारा फोकस रहेगा
कुछ मैथर्ड में आपको बता देता हूं की कैसे
इजीली रहेंगे लेकिन यहां पर देखिए एक आधा
चीज मैं आपको और इंटरेस्टिंग है यहां पे
दिखाता हूं कौन सा लॉक करके तो सबसे पहले
की आपको कोई प्रॉपर्टी से पता है तो इजीली
आपको जैसे देखना है तो मैं सपोर्ट करिए
गेम नेम लिया उसकी किस एक्सेस करनी है तो
मैं जीरो थी उसकी एक्सेस करता हूं तो
ऑब्वियस सी बात है कोई सरप्राइज नहीं होना
चाहिए आप लोगों को की वैल्यू चाहिए तो की
वैल्यू पर हमें एक्सेस करना ए गया है इसके
अलावा सिर्फ इतना ही नहीं जो हमने यहां पे
ये प्रोटोटाइप देखा था ये भी एक्सेस किया
जा सकता है तो आप क्या कर सकते हैं डॉट और
यहां पे बहुत सारे सिंटेक्स इसको एक्सेस
करने के एक से सिंटेक्स में मैं आपको
बताता हूं अंडरस्कोर अंडरस्कोर प्रोटो ये
दिख रहा है एक अंडरस्कोर है वीडियोस में
बट ये दो अंडरस्कोर हैं और अंडरस्कोर
अंडरस्कोर और भी तरीके हैं बट ये मेथड
सबसे इजी है आपके लिए तो आप देखेंगे तो आप
देखेंगे की हां ये ऑब्जेक्ट मिल गया ये
ऑब्जेक्ट अभी आपको एम्टी मिला है लेकिन
एक्चुअली में ये एम्टी नहीं है इसके अंदर
और भी बहुत सारी वैल्यूज है सबसे इजी
तरीका है वैल्यूज को देखने का यहां पे आप
कौन सा लॉक के अंदर एक्सेस आप सबको कर
सकते हैं अभी जितने भी मैथर्ड हैं उनको
एक्सेस करने के लिए आपको ऐसा नहीं करना
पड़ेगा
नहीं आप डायरेक्ट ही एक्सेस कर सकते हैं
ये सिंटेक्स है तो उसमें सिंटेक्स मैं
आपको प्रोटॉन नहीं लगाना पड़ता बट आप
देखना चाहें तो ऑब्जेक्ट देख सकते हैं ऐसी
कोई बात नहीं है तो कुछ मैं आपको ऑब्जेक्ट
इसके उसे करके दिखा देता हूं की किस तरह
से किए जाते हैं तो कौन सा लॉक करते हैं
हम यहां पे तो सबसे पहले हम चाहते हैं गेम
नेम पे अब हमने अभी देखा है यहां पे
नेम की सबसे पहली जो हमने चीज देखी वो एक
प्रॉपर्टी देखी डॉट लेंथ अभी जितने भी
मैथर्ड हैं इसका एक इंटरेस्टिंग चीज बताता
हूं आपको कहीं पे भी यह नहीं लिखना पड़ेगा
जैसे आप डॉट लेंथ एक्सेस करते हैं वैसे ही
आप सारे प्रोटो टाइप के मेथड भी एक्सेस कर
सकते हैं और एग्जांपल यहां पे जाता हूं और
मैं इसको बोलता हूं डॉट लेंथ
वेरी गुड और इसको मैं प्रिंट करता हूं
यहां पर तो 8 यहां पर लेंथ ए गई लेकिन और
भी जो मेथड है वह इसी तरह से डायरेक्ट
एक्सेस कर सकते हैं जैसे की फॉर एग्जांपल
प्रोटोकॉल के अंदर में गया और यहां पर आप
थोड़ा सा स्क्रॉल करेंगे तो आपको तू
सेक्शन में कुछ मैथर्ड दिखेंगे तो लोअर
केस तू अपार केस ये सारे और उनके आगे एफ
लिखा हुआ है मतलब ये सारे फंक्शंस हैं
सारे के सारे एफ है यहां पे देख सकते हैं
आप तो ये सारे के सारे फंक्शंस या फिर
मेथड से जो आपके लिए डायरेक्टली अवेलेबल
है तो एक हम इसमें से उसे करके देखते हैं
डॉट तू अपार केस तो आप नोटिस करेंगे मैंने
ये नहीं लिखा है यहां पे की डॉट अंडरस्कोर
अंडरस्कोर प्रोटो अंडरस्कोर अंडरस्कोर और
उसके बाद मैं लिख रहा हूं तू अपार केस में
डायरेक्टली aparkesh उसे कर सकता हूं ये
फीचर हम कैसे आता है क्या आता है यह जाओ
स्क्रिप्ट का पूरा सिंटेक्स हम प्रोटॉन
टाइप ए रहे हैं वाली वीडियो में समझेंगे
बट अभी के लिए हम एक मेथड यहां पे रन करके
देखते हैं तो हमें जो वैल्यू मिली वो सारा
का सारा कन्वर्ट हो गया लेकिन इसने हमारी
ओरिजिनल स्ट्रिंग को चेंज नहीं किया है
क्यों ये हमने पिछले वीडियो में देख चुके
हैं ऑलरेडी की आप जब भी ऐसा करते हैं तो
स्टार्क और जो हिप वीडियो है जो कमेंट में
बताइएगा किस-किस ने देख लिया है तो उनको
ये समझ में आएगा की हान और इसने वैल्यू
चेंज नहीं हुई है क्यों ये आप इंटरव्यू
में हमेशा आंसर कर सकते हैं तो इसीलिए
पहले मैं इसको स्ट्रांग कर रहा हूं कुछ और
इंटरेस्टिंग मेथड के बारे में मैं आपको
बता देता हूं जैसे की सपोर्ट करिए की आपको
कोई कैरेक्टर देखना है की ये कैरक्टर किस
पोजीशन पे है या क्या है तो स्ट्रिंग के
अंदर एक मेथड होता है ये क्या है आते तो
कौन सा कैरक्टर किस पोजीशन पे जैसे सपोस
करिए इसके अंदर मुझे देखना है टिक इस
पोजीशन पे है तो आप डायरेक्टली यहां पे एक
चीज इंपॉर्टेंट ध्यान रखिएगा ऐसे टीम नहीं
लिख सकते इसको अगर आप रन करेंगे तो आप
देखेंगे की ये बोल रहा है की अरे ऐसा
थोड़ी ना होता है की आप डिफाइन कर दोगे
ऐसे आपको एक स्ट्रिंग मैच कर देंगे या फिर
एक कैरक्टर मैच करना है तो कैरक्टर तो दो
तो इस तरह से हमने कैरक्टर लिया इसको रन
कर और मुझे मिल गया यहां पे की आपके पास
ये
[संगीत]
ओह माय बेड थोड़ा सा भावनाओं में ज्यादा
हो गए तो कैरक्टर देखना है की किस पोजीशन
पे कैरक्टर है तो मैंने यहां पे थोड़ा सा
इंडेक्स लिख दिया इस तरह से नहीं कैरक्टर
आते तो किस इंडेक्स पर कौन सा कैरक्टर है
वो हम देख सकते हैं तो जैसे मुझे देखना है
की सेकंड पोजीशन पे कौन सा कैरक्टर है तो
यहां पे आप नंबर्स पास करते हैं ना की
कैरेक्टर माय बेड होता है प्रोग्रामिंग
में होता है कई बार तो अब देखते हैं सेकंड
पोजीशन पे कौन सा है तो जीरो वैन और तू तो
यहां पे टी कैरक्टर है से करते हैं इसको
रन करते हैं बाकी मैंने सब कमेंट कर दिया
क्योंकि थोड़ा सा कंफ्यूज कर रहे द तो
यहां पर हमने देखा की इस पोजीशन पे है
आपका टी एल एम एन तो ये तो हो गया
कैरेक्टर अच्छा अब जब बात चली रही है की
आपको पता करना है की कौन सा पोजीशन पे कौन
सा कैरक्टर तो इसका रिवर्स करना हो तो
क्या करें जैसे सपोस करिए मुझे पता करना
है की टी किस पोजीशन पे है वो पता करने के
लिए भी उसके लिए भी आपके पास मेथड है
सिंपल इंडेक्स ऑफ तो इंडेक्स ऑफ के अंदर
आप पता लगा सकते हैं की ये कैरक्टर किस
पोजीशन पे आपके पास ए रहा है और यहां पे
आप टी लिख सकते हैं तो जैसे मैं इसको से
करता हूं और वैसे रन करके देखते हैं तो
मुझे पता लग गया की सेकंड पोजीशन पे टी है
वेरीफाई भी हो गया ठीक है ओके बड़ा ही इसे
था लेकिन अब यहां पे कुछ इंटरेस्टिंग
मैथर्ड आपको बताता हूं मैं कई बार क्या
होता है स्ट्रिंग को आपको कुछ पार्ट्स में
ब्रेक करना होता है या उसको सैनिटाइज करना
होता है उसे तरह के मैथर्ड तो स्ट्रिंग के
मैथर्ड के बारे में आप जितना ज्यादा
जानेंगे उतना ही आपके लिए फायदा होगा अब
हमेशा ऐसा नहीं की आपको जाना है एमडीएम के
डॉक्स में देखना है कुछ सबसे जो आसान
तरीका है किसी भी मेथड के बारे में देखना
जानना वो सिंपली आप यहां पे आके देख सकते
हैं जैसे सपोस करिए हमने देखना लोअर केस
आप इसको ओपन करेंगे नाम से ही पता लग रहा
है की लोअर केस है बस ठीक है इससे कम हो
जाता है और किसी का भी अगर आपको लगे की
जैसे मुझे सब स्ट्रिंग का नहीं पता ये
कैसे कम करता है तो सीधा जाइए एमडी एंड
डॉग्स पे तो मैं सभी को raycommend करूंगा
की एक बार थोड़ा सा 15 मिनट 1/2 घंटा
बताइए या फिर एक आर्टिकल लिखिए की
स्ट्रिंग्स के मेथड कितने हैं एक बार अगर
आप सारे मैथर्ड के थ्रू गो थ्रू कर लेंगे
तो इंटरव्यू से लेकर सभी को आपके पास
क्रैक हो जाएगा अच्छा कुछ और मैथर्ड आपको
बताऊंगा ऐसा नहीं की सिर्फ यही पे आपको
मैं छोड़ दूंगा कुछ और मैथर्ड आपको बताता
हूं जैसे देखिए हमारे पास ये मेथड है अभी
हमने लिखा यहां पर हितेश हक तो मैं क्या
करता हूं यहां पर लिख देता हूं हितेश दश क
ताकि और भी कुछ अब प्रैक्टिस कर पाए तो
कुछ और मैथर्ड मैं आपको बताता हूं आप सबसे
इंपॉर्टेंट जो मेथड है पहले हमने वेरिएबल
का नाम रखा गेम नाम तो ठीक है गेम नाम अब
इसके अंदर मुझे क्या करना है इस सिंपली
मुझे करना है स्लाइस तो आप इसको किसी
वेरिएबल में भी स्टोर कर सकते हैं तो मैं
इसको एक वेरिएबल में स्टोर कर लेता हूं
न्यू स्ट्रिंग नाम से और मैंने बोला ये जो
गेम नाम है मुझे इसको करना है एक सब
स्ट्रिंग में डिवाइड तो बोला की ये ठीक है
सब स्ट्रिंग में आप कर लीजिए अब क्या-क्या
इसके अंदर अरगुमेंट देने पड़ेंगे मुझे
देना पड़ेगा स्टार्ट नंबर और देना पड़ेगा
एक एंड नंबर ठीक है तो स्टार्ट नंबर मैं
इसको देता हूं सपोर्ट करिए जीरो और एन
नंबर देता हूं
इंटरेस्टिंग चीज क्या है जब हम इसको कंसोल
लॉक करेंगे तो आपको ये पता होना चाहिए की
एक्चुअली में आंसर आएगा क्या कैसे मैं
आपको बताता हूं ये भी डिटेल में
तो यहां पर ह आई टी आई नोटिस करिए
मेरे पास जीरो से मैंने स्टार्ट कर तो यह
जो है जीरो वैन तू
नोटिस करिए तीन कैरक्टर है तो मतलब लास्ट
में जो आपने वैल्यू डाली है वो इंक्लूड
नहीं हो रही है यह सबसे इंपॉर्टेंट चीज है
जो आपको ध्यान रखनी है अच्छा ये तो हो गया
आपका बेसिक्स सब स्ट्रिंग में हमने उसको
डिवाइड कर लिया लेकिन और भी मैथर्ड आते
हैं और अगर ये सब कुछ बेसिक सी है तो यहां
पर हमने देखा अब आपके पास ये जो सब
स्ट्रिंग ए गया है इसके साथ एक और
इंपॉर्टेंट इंटरेस्टिंग चीज है बताता है
आपको अभी तो यहां पे भी हम क्या करते हैं
एक नया वेरिएबल ले लेते हैं अंदर स्ट्रिंग
और इसके अंदर क्या करते हैं इस बार एक और
नया मेथड उसे करते हैं उसे मेथड के अंदर
थोड़ी सी और इंटरेस्टिंग चीज हैं जिसका
नाम है डॉट स्लाइस तो डॉट स्लाइस के अंदर
आप क्या कर सकते हैं
क्या लगता है स्लाइस का आप इसमें नेगेटिव
वाल भी दे सकते हो अगर आप नेगेटिव वैल्यूज
देंगे तो रिवर्स से स्टार्ट होगा जैसे
हमें पता है की इसका लेंथ अभी आते है तो
सपोस करिए मैं इसका स्टार्ट देता हूं
-8 तो अभी क्या वैल्यू आएगा तो ये सबसे
इंटरेस्टिंग रहता है तो आपके पास वापस से
क्योंकि आपने अन इसको प्रिंटिंग नहीं कर
अभी तो हमने
तो एक बार इसको रन करते हैं और प्रिंट
करते हैं क्योंकि रिजल्ट्स के बड़े
इंटरेस्टिंग आते हैं जब आप रिवर्स वैल्यूज
देते हैं तो देखिए आईटीआई तो इसमें पीछे
से स्टार्ट कर और फिर फोर कैरेक्टर
क्योंकि ओबवियस सी बात है -8 है तो
नेगेटिव से जाके स्टार्ट करेगा तो ये बड़े
स्लाइस के अंदर इंटरेस्टिंग कॉन्सेप्ट आते
हैं स्लाइस आप काफी बार उसे करेंगे और
स्लाइस के अंदर ही आप नेगेटिव वैल्यूज उसे
कर सकते हैं क्या सबस्ट्रिंग में भी
नेगेटिव वैल्यू उसे कर सकते हैं बिल्कुल
अभी आपको बताते हैं इसके अंदर अगर वैल्यूज
उसे करेंगे इस तरह की नेगेटिव तो ये आपको
देगा की ठीक है मैं तो नहीं वो बेकरार की
आपने नेगेटिव वैल्यूज दी है मैं आपकी
वैल्यू को इग्नोर कर दूंगा और जीरो से
स्टार्ट कर दूंगा तो यहां पे हम नहीं दे
सकते हैं ठीक है बड़ा इंटरेस्टिंग
कॉन्सेप्ट है और इजी भी है ठीक है ये तो
हो गया आपका बेसिक लेकिन अब एक और मेथड आप
उसे करोगे स्ट्रिंग के अंदर कई बार वो
होगा आपके प्रेम और एक और मेथड होता है वो
है रिप्लेस अब ये ट्रिम और रिप्लेस मेथड
कहां पे उसे आएगा देखिए क्या होगा की कई
बार जैसे आपने बोला की न्यू स्ट्रिंग वैन
है और आपने एक स्ट्रिंग डिफाइन कारी जिसके
अंदर बहुत सारे स्पेस हैं फिर आपने लिखा
है देश और फिर बहुत सारे स्पेस हैं इस तरह
की स्ट्रिंग्स बहुत ही कॉमन ले आती है
कहां पे आती है जब आप एक इनपुट फॉर्म
बनाएंगे अपनी वेबसाइट पर तो कई बार क्या
होता है यूजर डिलीवरी या अननोइंग्ली या
फिर नो इंग्लिश बहुत सारे एक्स्ट्रा
कैरेक्टर्स और स्पेशली स्पेस ऐड कर देता
है वो स्पेशल कई बार हमें नहीं चाहिए होते
हैं obbvious सी बात है पासवर्ड फुल में
ऐसा नहीं करेंगे बट हान कई बार जैसे ईमेल
दे रहा है तो वहां पे मुझे ये स्टार्टिंग
के स्पेस ये लास्ट के स्पेस ये सब नहीं
चाहिए मैं डेटाबेस में ये सब से नहीं करना
चाहूंगा तो उसे केस में आपको कुछ भी नहीं
करना है आप सिंपली देखेंगे कौन सा लोग हम
इसको करके देखते हैं तो पहली बार तो हम
कौन सा लॉक करते हैं इस न्यू स्ट्रिंग को
और एक और कौन सा लॉक करते हैं
अब इसको जब हम रन करते हैं तो आप नोटिस
करेंगे फर्स्ट वाले के अंदर देखिए
स्टार्टिंग स्पेस और यहां पे एंड स्पेस भी
है लेकिन जो सेकंड वाला है उसके अंदर
एक्सरसाइज को सिंपली रिमूव कर देता है अब
इस ट्रिम के बारे में थोड़ा सा मैं आपको
और इंटरेस्टिंग बताता हूं एक और चीज
हवा स्क्रिप्ट और एमडीएम ऑफ कोर्स
तो यहां पर आप जाएंगे तो अभी हमें मिल गया
की ट्रिम इस तरह से उसे होता है लेकिन
सबसे इंपॉर्टेंट चीज है यहां पे और इसका
सिंटेक्स पढ़ना और भी वैल्यूज है जैसे
ट्रिम स्टार्ट ट्रिम एंड अब इसको उसे करते
हैं लोग ज्यादातर ट्रे में उसे करते हैं
क्योंकि स्टार्ट और एंड दोनों का उसे कर
लेता है तो नोटिस करिए इस तरह से ये उसे
कर लेता है ब्राउज़र कंपैटिबिलिटी भी है
और क्या-क्या ऑप्शंस आप देख सकते हैं
प्लीज एक बार इस तरह से डॉक्यूमेंटेशन पे
जाकर जरूर देखिएगा अब क्योंकि हम
डॉक्यूमेंटेशन पे गए इसलिए आपको पता लगा
की अच्छा ड्रीम स्टार्ट भी कोई चीज है और
ट्रिम एंड भी कोई चीज है और नोटिस करिएगा
ये व्हाइट स्पेस कैरेक्टर्स पे ही कम करता
है लाइन टर्मिनेटर पे आप प्लस डी लाइन
टर्मिनेटर मतलब जो न्यू लाइन स्लैश एन
कैरक्टर आप उसे करते हैं तो इस तरह से जब
आप डॉक्यूमेंटेशन पे जाते हैं तभी आपको कई
बार नए मैथर्ड का पता लगता है हमें क्या
नए मैथर्ड पता लगे स्टार्ट भी है और
ट्रेंड भी है ठीक है वापस से आते हैं यहां
पे ये तो हो गया हमारा ट्रिम का वैल्यू अब
एक और वैल्यू आप उसे करेंगे जो की है कई
बार रिप्लेस आप बताते हैं आपको उसका भी
एग्जांपल कई बार क्या होगा जैसे की फॉर
एग्जांपल एक आपके पास यूआरएल आया वो
यूआरएल था कुछ
सपोज करें एचटीटीपीएस
और कोई और वेरिएबल hitesh.com ले लेते हैं
चलिए उसके अंदर
इस तरह की यूआरएल आपने काफी बार देखेंगे
अब प्रॉब्लम क्या है की जो आपका ब्राउज़र
है वो स्पेस नहीं समझता है अब किसी ने वेब
पेज का नाम दे दिया है हितेश स्पेस चौधरी
तो ब्राउज़र क्या करेगा ऑटोमेटेकली इसको
कन्वर्ट कर देगा पर्सन 20 यू आर एलन
कोडिंग में अब इस सिचुएशन में क्या होगा
की आपको चाहिए की या ये जो चीज है यह
रिमूव ओबेसिटी में करना चाहूंगा तो दो-तीन
आपके पास मेथड से किस तरह से आप करना
चाहेंगे या किस तरह से या सपोस करिए मुझे
करना है की ये जो हितेश यूआरएल है इसी को
मुझे कंपलीटली रिप्लेस करना है तो उन सारे
केसेस में आप इसको चेंज कर सकते हैं तो
जैसे यूआरएल है उसके अंदर आप दल सकते हैं
डॉट रिप्लेस
तो जैसे आप रिप्लेस देंगे तो इसको बोलेंगे
क्या मैं सर्च करूं और किस मैं उसको
रिप्लेस करूं तो सपोर्ट करिए की आप चाहते
हैं की मैं इस पुरी स्ट्रिंग के अंदर
ढूंढना चाहता हूं परसेंट 20 को और रिप्लेस
करना चाहता हूं उसको
तो कौन सा लॉक करके देखते हैं क्या वैल्यू
आती है हमारे पास
करते हैं और इसको रन करके देखते हैं तो
मैंने रन कर तो ऑटोमेटेकली हितेश दश चौधरी
हो गया वो तो अभी यूआरएल उसेबल है तो इस
तरह के कुछ सेंटेंस जितना आप स्ट्रिंग के
साथ फैमिलियर होंगे उतना आपको आगे जाके
हेल्प मिलेगी बैक एंड डेवलपमेंट में फ्रंट
एंड डेवलपमेंट क्योंकि आपको बस पता है की
अच्छा ठीक है ये स्ट्रिंग ए गई मेरे पास
अब मेरे को बहुत सारे मेथड पता है
स्ट्रिंग के और मैं बहुत सारा से वैलिड
ड्राइव कर सकता हूं ठीक है
इतना ही नहीं आप इससे रिप्लेस नहीं आप
इससे पूछ भी सकते हैं कुछ क्वेश्चंस जैसे
की फॉर एग्जांपल
यूआरएल डॉट इंक्लूड्स तो क्या यूआरएल के
अंदर कुछ कीवर्ड्स हैं जैसे की हितेश है
या नहीं तो इसके बारे में आप जान सकते हैं
ऑब्वियस सी बात है कौन सा लोग हम कर लेते
हैं यहां पे
स्ट्रिंग्स सबसे ज्यादा पावरफुल होते हैं
किसी भी लैंग्वेज में तो यहां पे ट्रू है
लेकिन अगर आप पता करना चाहते हैं की इसके
अंदर
कुछ और जैसे की
यह की वर्ड है या नहीं तो आप यह भी पूछ
सकते हैं तो इसमें का फॉल्स यह नहीं है
यहां पर अवेलेबल तो इस तरह के कुछ वैल्यूज
है आप इजीली यहां पे देख सकते हैं अच्छा
इसके अंदर बहुत सारे इंटरेस्टिंग चीज भी
है जैसे सपोस करिए अभी मेरे पास एक
स्ट्रिंग है यहां पे हितेश एफसी अब मैं
चाहता हूं की जो स्ट्रिंग है कोई रीजन है
पर ये स्ट्रिंग को मैं अरे में कन्वर्ट
करना चाहता हूं बेस्ट किस पे क्योंकि ऐसे
थोड़ी ना की कहीं से भी कुछ भी वैल्यू
लेके ए रहा है मैं कन्वर्ट कर दूंगा मैं
चाहता हूं की ऐसे जितने भी वैल्यूज हैं
हितेश क डेड दश कॉम तो ये अलग पार्ट में
स्प्लिट हो जाए बेस्ड ऑन दश बेस्ड ऑन किसी
भी हो सकता है स्पेस भी हो सकता है दश भी
हो सकता है कुछ भी हो सकता है तो ये सब
कैसे करूंगा इसके लिए भी मेथड है ठीक है
तो आपको दिखाते हैं तो सपोर्ट करिए आप
इसको लॉक तो हम करेंगे करेंगे और
गेम नहीं मैन गेम नाम हमने उसे कर था आप
मेथड उसे कर सकते हैं स्प्लिट अब मेथड तो
मैंने बता दिया स्प्लिट लेकिन मुझे उसे
करना नहीं आता यह स्प्लिट कैसे उसे करूं
तो सिंपली मैं जाऊंगा वापस से गूगल पे और
इस बार बोलूंगा की मुझे बताओ ये स्प्लिट
मेथड कैसे उसे करना है या फिर सपोज करिए
आप यहां पे देख लेते हैं आपको इस प्लेट
मेथड लगा बड़ा इंटरेस्टिंग की ये स्प्लिट
जो है यहां पे ये बड़ा इंटरेस्टिंग है
देखते हैं इसके अंदर क्या है इसके लेंथ तू
है नाम स्प्लिट अरगुमेंट मुझे समझ नहीं ए
रहा है तो मैंने बोला की ठीक है यहां पे
जाते हैं स्प्लिट इसको देखते हैं कैसे तो
इसने कहा की ये जो पूरा स्ट्रिंग है इस
स्ट्रिंग को स्प्लिट करने के लिए स्पेस के
बेस पर मैं स्ट्रिंग को स्प्लिट कर रहे
हैं और यहां पर आउटपुट ले रहे हैं तो क्या
आउटपुट आएगा हमारा तो हम तो चाहते हैं की
पूरा ही मैं आउटपुट एक बार देखूं की
स्प्लिट क्या आउटपुट दे रहा है तो आप चाहे
तो यहां पे भी देख सकते हैं रन करके अभी
तो आपको समझ में आएगी कैसे इसको उसे करते
हैं आपको चाहिए सेपरेटर और एक लिमिट चलिए
मैं लिमिट नहीं देता हूं मैं देता हूं
सिर्फ यहां पर सेपरेटर ठीक है करके देखते
हैं तो मेरे पास जो सेपरेटर है वो है
सिंपली
स्पेस भी हो सकता है बट मेरे पास दश देखते
हैं वैल्यू क्या आता है उसका यहां पर
जिसके अंदर तीन स्ट्रिंग्स है मैंने
स्प्लिट कर बेसिस ऑन दश बट आप स्प्लिट कर
सकते किसी पर अब ये तो हुआ थोड़ा सा बेसिक
अब इसके अलावा और भी चीज हैं आप बहुत सारे
स्ट्रिंग्स की वैल्यू भी निकल सकते हैं
बहुत सारी और भी चीज जैसे यहां पे आप
देखेंगे ये तो हमने स्प्लिट का बात कर
स्मॉल मैंने कभी उसे ही नहीं कर मुझे पता
भी नहीं है क्या होता है ऑनेस्टली बट बहुत
सारे ऐसे मैथर्ड है तो मैं आपको सिर्फ
इतना raycommend करूंगा की इस वीडियो के
बाद आप जाइए थोड़ा सा आपको स्ट्रिंग के
बारे में अब नॉलेज है थोड़ा सा एमडीएम का
हेल्प लीजिए और थोड़ा सा यहां पर सिर्फ
इसका हेल्प कीजिए की ब्लिंक क्या है बोल्ड
क्या है कैरक्टर क्या है कॉन्टैक्ट क्या
है कंस्ट्रक्टर क्या क्या करता है एंड्स
की क्या करता है फिक्स क्या करता है अगर
ये थोड़ा सा टाइम दे देंगे पंच से 10 मिनट
ज्यादा नहीं 15 मिनट में हो जाएगा तो आपको
स्ट्रिंग के अंदर बहुत ज्यादा expities
मिलेगी एक चीज का बस ध्यान रखिएगा की
स्ट्रिंग की प्रैक्टिस करनी पड़ेगी और
दूसरी इंपॉर्टेंट चीज प्लीज प्लीज सेंड
टेक्स्ट को फॉलो कीजिएगा बैक वाले को यह
जो प्लस करके कमा करके यह सिंटेक्स बहुत
पुराना हो गया कोई भी नए कोड में ऐसा नहीं
लिखता है उम्मीद करता हूं आपको वीडियो
पसंद आया होगा मुझे बनाने में बहुत मजा
आया आपने ऑलरेडी सब्सक्राइब्ड हो फुल्ली
कर दिया होगा और वीडियो को फैला दो सारे
दोस्तों में चलिए मिलते हैं अगले वीडियो
में
Voir Plus de Vidéos Connexes
JavaScript Strings
C++ Strings | What is String? full Explanation
Cara Memanipulasi String pada PHP yang harus dipahami Programmer | #9 - Belajar PHP Dasar
Python Tutorial for Beginners 2: Strings - Working with Textual Data
Strings (Basics of Memory) | Godot GDScript Tutorial | Ep 10.2
C_64 Strings in C- part 3 | printf and puts function in C
5.0 / 5 (0 votes)