Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • GfG 160: Daily DSA
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Databases
  • SQL
  • MySQL
  • PostgreSQL
  • PL/SQL
  • MongoDB
  • SQL Cheat Sheet
  • SQL Interview Questions
  • MySQL Interview Questions
  • PL/SQL Interview Questions
  • Learn SQL and Database
Open In App
Next Article:
MySQL - String Functions
Next article icon

MySQL - String Functions

Last Updated : 27 Jun, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

MySQL is one of the most widespread relational database management systems that covers many functions to manipulate the strings precisely. Processing text data in MySQL can go from a simple concatenation to pattern matching/substring extraction. In this article, we will be considering some commonly used MySQL string functions and their syntax, usage as well as examples.

MySQL - String Functions

Some most important String Functions are defined below:

Function

Description

CONCAT_WS()

It Concatenates strings with a specified separator.

CONCAT()

It Concatenates two or more strings.

CHARACTER_LENGTH()

It Returns the number of characters in a string.

ELT()

It Returns the string at the specified index from a list of strings.

EXPORT_SET()

It Returns a string where each bit of a bitmap value corresponds to a value in a set.

FIELD()

It Returns the index (position) of a string in a list of strings.

FIND_IN_SET()

It Returns the position of a string within a comma-separated list of strings.

FORMAT()

It Formats a number to a format like '#,###,###.##', rounded to a specified number of decimal places.

FROM_BASE64()

It Decodes a base64-encoded string.

HEX()

It Returns a string representation of a hexadecimal value.

INSERT()

It Inserts a substring into a string at a specified position and for a certain number of characters

INSTR()

It Returns the position of the first occurrence of a substring in a string.

LENGTH()

The LENGTH() function returns the length of a string in bytes.

LIKE()

The LIKE() function is used for pattern matching in SQL queries. It allows you to search for a specified pattern in a string.

LOAD_FILE()

The LOAD_FILE() function reads the content of a file on the server and returns it as a string.

LOCATE()

The LOCATE() function returns the position of the first occurrence of a substring within a string.

LOWER()

The LOWER() function converts all characters in a string to lowercase.

LPAD()

The LPAD() function pads a string to the left with another string to a certain length.

LTRIM()

The LTRIM() function removes leading spaces (or any specified characters) from a string.

MAKE_SET()

The MAKE_SET() function returns a set of bits that corresponds to the values of the arguments.

MID()

The MID() function extracts a substring from a string, starting from a specified position.

OCTET_LENGTH()

The OCTET_LENGTH() function returns the length of a string in bytes.

OCT()

The OCT() function converts a number from decimal to octal format.

ORD()

The ORD() function returns the Unicode code point value of the leftmost character of a string.

POSITION()

The POSITION() function returns the position of the first occurrence of a substring within a string.

QUOTE()

It Returns a string enclosed in single quotes, with special characters escaped.

REPLACE()

The REPLACE() function replaces all occurrences of a substring within a string with another substring

RPAD()

The RPAD() function pads a string to the right with another string to a certain length.

REVERSE()

It Reverses a string.

REPEAT()

It Repeats a string a specified number of times.

RIGHT()

It Returns the rightmost characters of a string.

SOUNDEX()

The SOUNDEX() function returns a phonetic representation of a string.

Examples of MySQL - String Functions

1. CONCAT_WS()

SELECT CONCAT_WS(', ', 'apple', 'banana', 'orange') AS Concatenated_String;

Output:

+----------------------+
| Concatenated_String |
+----------------------+
| apple, banana, orange |
+----------------------+

2. CONCAT()

SELECT CONCAT('Hello', ' ', 'World') AS Concatenated_String;

Output:

+-------------------+
| Concatenated_String |
+-------------------+
| Hello World |
+-------------------+

3. CHARACTER_LENGTH()

SELECT CHARACTER_LENGTH('Hello World') AS String_Length;

Output:

+--------------+
| String_Length |
+--------------+
| 11 |
+--------------+

4. ELT()

SELECT ELT(3, 'apple', 'banana', 'orange', 'grape') AS Selected_String;

Output:

+----------------+
| Selected_String |
+----------------+
| orange |
+----------------+

5. EXPORT_SET()

SELECT EXPORT_SET(5, 2, '0', ',', '1') AS Binary_Set;

Output:

+------------+
| Binary_Set |
+------------+
| 1,0,1 |
+------------+

6. FIELD()

SELECT FIELD('banana', 'apple', 'banana', 'orange') AS Position;

Output:

+----------+
| Position |
+----------+
| 2 |
+----------+

7. FIND_IN_SET()

SELECT FIND_IN_SET('banana', 'apple,banana,orange') AS Position;

Output:

+----------+
| Position |
+----------+
| 2 |
+----------+

8. FORMAT()

SELECT FORMAT(1234567.89, 2) AS Formatted_Number;

Output:

+-------------------+
| Formatted_Number |
+-------------------+
| 1,234,567.89 |
+-------------------+

9. FROM_BASE64()

SELECT FROM_BASE64('SGVsbG8gV29ybGQ=') AS Decoded_String;

Output:

+-------------------+
| Decoded_String |
+-------------------+
| Hello World |
+-------------------+

10. HEX()

SELECT HEX('Hello') AS Hexadecimal_Value;

Output:

+-------------------+
| Hexadecimal_Value |
+-------------------+
| 48656C6C6F |
+-------------------+

11. INSERT()

SELECT INSERT('Hello World', 7, 0, 'Beautiful ') AS Modified_String;

Output:

+---------------------+
| Modified_String |
+---------------------+
| Hello Beautiful World |
+---------------------+

12. INSTR()

SELECT INSTR('Hello World', 'Wor') AS Position;

Output:

+----------+
| Position |
+----------+
| 7 |
+----------+

13. LOWER()

SELECT LOWER('Hello World') AS Lowercase_String;

Output:

+------------------+
| Lowercase_String |
+------------------+
| hello world |
+------------------+

14. LPAD()

SELECT LPAD('apple', 10, '*') AS Padded_String;

Output:

+---------------+
| Padded_String |
+---------------+
| *****apple |
+---------------+

15. LTRIM()

SELECT LTRIM('   Hello World   ') AS Trimmed_String;

Output:

+----------------+
| Trimmed_String |
+----------------+
| Hello World |
+----------------+

16. MAKE_SET()

SELECT MAKE_SET(1, 'a', 'b', 'c') AS Set_Values;

Output:

+------------+
| Set_Values |
+------------+
| a |
+------------+

17. MID()

SELECT MID('Hello World', 7, 5) AS Extracted_String;

Output:

+------------------+
| Extracted_String |
+------------------+
| World |
+------------------+

18. OCTET_LENGTH()

SELECT OCTET_LENGTH('Hello World') AS Byte_Length;

Output:

+-------------+
| Byte_Length |
+-------------+
| 11 |
+-------------+

19. OCT()

SELECT OCT(42) AS Octal_Number;

Output:

+--------------+
| Octal_Number |
+--------------+
| 52 |
+--------------+

20. ORD()

SELECT ORD('A') AS Unicode_Code;

Output:

+--------------+
| Unicode_Code |
+--------------+
| 65 |
+--------------+

21. POSITION()

SELECT POSITION('bar' IN 'foobarbar') AS Position;

Output:

+----------+
| Position |
+----------+
| 4 |
+----------+

22. QUOTE()

SELECT QUOTE('It\'s a beautiful day!') AS Quoted_String;

Output:

+--------------------------+
| Quoted_String |
+--------------------------+
| 'It\'s a beautiful day!' |
+--------------------------+

23. REPLACE()

SELECT REPLACE('Hello World', 'World', 'Universe') AS Modified_String;

Output:

+------------------+
| Modified_String |
+------------------+
| Hello Universe |
+------------------+

24. REPEAT()

SELECT REPEAT('Hello ', 3) AS Repeated_String;

Output:

+------------------+
| Repeated_String |
+------------------+
| Hello Hello Hello |
+------------------+

25. RIGHT()

SELECT RIGHT('Hello World', 5) AS RightmostString;

Output:

+-----------------+
| RightmostString |
+-----------------+
| World |
+-----------------+

26. RPAD()

SELECT RPAD('apple', 10, '*') AS Padded_String;

Output:

+---------------+
| Padded_String |
+---------------+
| apple***** |
+---------------+

27. RTRIM()

SELECT RTRIM('   Hello World   ') AS Trimmed_String;

Output:

+----------------+
| Trimmed_String |
+----------------+
| Hello World |
+----------------+

28. SOUNDEX()

SELECT SOUNDEX('Hello') AS Soundex_Value;

Output:

+---------------+
| Soundex_Value |
+---------------+
| H400 |
+---------------+

Conclusion

MySQL string functions have been developed to enable users do a lot of textual data manipulation in their databases. Whether you want to concatenate strings, extract substrings or execute complex pattern matching, MySQL has tools that are both efficient and powerful enough to fit your tasks. Good in database operations and data manipulation management, you will be able to improve your database processes and save your efforts


Next Article
MySQL - String Functions

M

muditgu1tud
Improve
Article Tags :
  • Databases
  • MySQL

Similar Reads

    SQL Interview Questions
    Are you preparing for a SQL interview? SQL is a standard database language used for accessing and manipulating data in databases. It stands for Structured Query Language and was developed by IBM in the 1970's, SQL allows us to create, read, update, and delete data with simple yet effective commands.
    15+ min read
    SQL Tutorial
    SQL is a Structured query language used to access and manipulate data in databases. SQL stands for Structured Query Language. We can create, update, delete, and retrieve data in databases like MySQL, Oracle, PostgreSQL, etc. Overall, SQL is a query language that communicates with databases.In this S
    11 min read
    Non-linear Components
    In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co
    11 min read
    SQL Commands | DDL, DQL, DML, DCL and TCL Commands
    SQL commands are crucial for managing databases effectively. These commands are divided into categories such as Data Definition Language (DDL), Data Manipulation Language (DML), Data Control Language (DCL), Data Query Language (DQL), and Transaction Control Language (TCL). In this article, we will e
    7 min read
    SQL Joins (Inner, Left, Right and Full Join)
    SQL joins are fundamental tools for combining data from multiple tables in relational databases. Joins allow efficient data retrieval, which is essential for generating meaningful observations and solving complex business queries. Understanding SQL join types, such as INNER JOIN, LEFT JOIN, RIGHT JO
    6 min read
    Normal Forms in DBMS
    In the world of database management, Normal Forms are important for ensuring that data is structured logically, reducing redundancy, and maintaining data integrity. When working with databases, especially relational databases, it is critical to follow normalization techniques that help to eliminate
    7 min read
    Spring Boot Tutorial
    Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance
    10 min read
    ACID Properties in DBMS
    In the world of DBMS, transactions are fundamental operations that allow us to modify and retrieve data. However, to ensure the integrity of a database, it is important that these transactions are executed in a way that maintains consistency, correctness, and reliability. This is where the ACID prop
    8 min read
    Class Diagram | Unified Modeling Language (UML)
    A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a project—like developers and designers—understand how the system is organized and how its components interact
    12 min read
    Steady State Response
    In this article, we are going to discuss the steady-state response. We will see what is steady state response in Time domain analysis. We will then discuss some of the standard test signals used in finding the response of a response. We also discuss the first-order response for different signals. We
    9 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

'); // $('.spinner-loading-overlay').show(); let script = document.createElement('script'); script.src = 'https://assets.geeksforgeeks.org/v2/editor-prod/static/js/bundle.min.js'; script.defer = true document.head.appendChild(script); script.onload = function() { suggestionModalEditor() //to add editor in suggestion modal if(loginData && loginData.premiumConsent){ personalNoteEditor() //to load editor in personal note } } script.onerror = function() { if($('.editorError').length){ $('.editorError').remove(); } var messageDiv = $('
').text('Editor not loaded due to some issues'); $('#suggestion-section-textarea').append(messageDiv); $('.suggest-bottom-btn').hide(); $('.suggestion-section').hide(); editorLoaded = false; } }); //suggestion modal editor function suggestionModalEditor(){ // editor params const params = { data: undefined, plugins: ["BOLD", "ITALIC", "UNDERLINE", "PREBLOCK"], } // loading editor try { suggestEditorInstance = new GFGEditorWrapper("suggestion-section-textarea", params, { appNode: true }) suggestEditorInstance._createEditor("") $('.spinner-loading-overlay:eq(0)').remove(); editorLoaded = true; } catch (error) { $('.spinner-loading-overlay:eq(0)').remove(); editorLoaded = false; } } //personal note editor function personalNoteEditor(){ // editor params const params = { data: undefined, plugins: ["UNDO", "REDO", "BOLD", "ITALIC", "NUMBERED_LIST", "BULLET_LIST", "TEXTALIGNMENTDROPDOWN"], placeholderText: "Description to be......", } // loading editor try { let notesEditorInstance = new GFGEditorWrapper("pn-editor", params, { appNode: true }) notesEditorInstance._createEditor(loginData&&loginData.user_personal_note?loginData.user_personal_note:"") $('.spinner-loading-overlay:eq(0)').remove(); editorLoaded = true; } catch (error) { $('.spinner-loading-overlay:eq(0)').remove(); editorLoaded = false; } } var lockedCasesHtml = `You can suggest the changes for now and it will be under 'My Suggestions' Tab on Write.

You will be notified via email once the article is available for improvement. Thank you for your valuable feedback!`; var badgesRequiredHtml = `It seems that you do not meet the eligibility criteria to create improvements for this article, as only users who have earned specific badges are permitted to do so.

However, you can still create improvements through the Pick for Improvement section.`; jQuery('.improve-header-sec-child').on('click', function(){ jQuery('.improve-modal--overlay').hide(); $('.improve-modal--suggestion').hide(); jQuery('#suggestion-modal-alert').hide(); }); $('.suggest-change_wrapper, .locked-status--impove-modal .improve-bottom-btn').on('click',function(){ // when suggest changes option is clicked $('.ContentEditable__root').text(""); $('.suggest-bottom-btn').html("Suggest changes"); $('.thank-you-message').css("display","none"); $('.improve-modal--improvement').hide(); $('.improve-modal--suggestion').show(); $('#suggestion-section-textarea').show(); jQuery('#suggestion-modal-alert').hide(); if(suggestEditorInstance !== null){ suggestEditorInstance.setEditorValue(""); } $('.suggestion-section').css('display', 'block'); jQuery('.suggest-bottom-btn').css("display","block"); }); $('.create-improvement_wrapper').on('click',function(){ // when create improvement option clicked then improvement reason will be shown if(loginData && loginData.isLoggedIn) { $('body').append('
'); $('.spinner-loading-overlay').show(); jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.unlocked-status--improve-modal-content').css("display","none"); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { showErrorMessage(e.responseJSON,e.status) }, }); } else { if(loginData && !loginData.isLoggedIn) { $('.improve-modal--overlay').hide(); if ($('.header-main__wrapper').find('.header-main__signup.login-modal-btn').length) { $('.header-main__wrapper').find('.header-main__signup.login-modal-btn').click(); } return; } } }); $('.left-arrow-icon_wrapper').on('click',function(){ if($('.improve-modal--suggestion').is(":visible")) $('.improve-modal--suggestion').hide(); else{ } $('.improve-modal--improvement').show(); }); const showErrorMessage = (result,statusCode) => { if(!result) return; $('.spinner-loading-overlay:eq(0)').remove(); if(statusCode == 403) { $('.improve-modal--improve-content.error-message').html(result.message); jQuery('.improve-modal--overlay').show(); jQuery('.improve-modal--improvement').show(); $('.locked-status--impove-modal').css("display","block"); $('.unlocked-status--improve-modal-content').css("display","none"); $('.improve-modal--improvement').attr("status","locked"); return; } } function suggestionCall() { var editorValue = suggestEditorInstance.getValue(); var suggest_val = $(".ContentEditable__root").find("[data-lexical-text='true']").map(function() { return $(this).text().trim(); }).get().join(' '); suggest_val = suggest_val.replace(/\s+/g, ' ').trim(); var array_String= suggest_val.split(" ") //array of words var gCaptchaToken = $("#g-recaptcha-response-suggestion-form").val(); var error_msg = false; if(suggest_val != "" && array_String.length >=4){ if(editorValue.length <= 2000){ var payload = { "gfg_post_id" : `${post_id}`, "suggestion" : `${editorValue}`, } if(!loginData || !loginData.isLoggedIn) // User is not logged in payload["g-recaptcha-token"] = gCaptchaToken jQuery.ajax({ type:'post', url: "https://apiwrite.geeksforgeeks.org/suggestions/auth/create/", xhrFields: { withCredentials: true }, crossDomain: true, contentType:'application/json', data: JSON.stringify(payload), success:function(data) { if(!loginData || !loginData.isLoggedIn) { grecaptcha.reset(); } jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('.suggest-bottom-btn').css("display","none"); $('#suggestion-section-textarea').hide() $('.thank-you-message').css('display', 'flex'); $('.suggestion-section').css('display', 'none'); jQuery('#suggestion-modal-alert').hide(); }, error:function(data) { if(!loginData || !loginData.isLoggedIn) { grecaptcha.reset(); } jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Something went wrong."); jQuery('#suggestion-modal-alert').show(); error_msg = true; } }); } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Minimum 4 Words and Maximum Words limit is 1000."); jQuery('#suggestion-modal-alert').show(); jQuery('.ContentEditable__root').focus(); error_msg = true; } } else{ jQuery('.spinner-loading-overlay:eq(0)').remove(); jQuery('#suggestion-modal-alert').html("Enter atleast four words !"); jQuery('#suggestion-modal-alert').show(); jQuery('.ContentEditable__root').focus(); error_msg = true; } if(error_msg){ setTimeout(() => { jQuery('.ContentEditable__root').focus(); jQuery('#suggestion-modal-alert').hide(); }, 3000); } } document.querySelector('.suggest-bottom-btn').addEventListener('click', function(){ jQuery('body').append('
'); jQuery('.spinner-loading-overlay').show(); if(loginData && loginData.isLoggedIn) { suggestionCall(); return; } // script for grecaptcha loaded in loginmodal.html and call function to set the token setGoogleRecaptcha(); }); $('.improvement-bottom-btn.create-improvement-btn').click(function() { //create improvement button is clicked $('body').append('
'); $('.spinner-loading-overlay').show(); // send this option via create-improvement-post api jQuery.ajax({ url: writeApiUrl + 'create-improvement-post/?v=1', type: "POST", contentType: 'application/json; charset=utf-8', dataType: 'json', xhrFields: { withCredentials: true }, data: JSON.stringify({ gfg_id: post_id }), success:function(result) { $('.spinner-loading-overlay:eq(0)').remove(); $('.improve-modal--overlay').hide(); $('.create-improvement-redirection-to-write').attr('href',writeUrl + 'improve-post/' + `${result.id}` + '/', '_blank'); $('.create-improvement-redirection-to-write')[0].click(); }, error:function(e) { showErrorMessage(e.responseJSON,e.status); }, }); });
"For an ad-free experience and exclusive features, subscribe to our Premium Plan!"
Continue without supporting
`; $('body').append(adBlockerModal); $('body').addClass('body-for-ad-blocker'); const modal = document.getElementById("adBlockerModal"); modal.style.display = "block"; } function handleAdBlockerClick(type){ if(type == 'disabled'){ window.location.reload(); } else if(type == 'info'){ document.getElementById("ad-blocker-div").style.display = "none"; document.getElementById("ad-blocker-info-div").style.display = "flex"; handleAdBlockerIconClick(0); } } var lastSelected= null; //Mapping of name and video URL with the index. const adBlockerVideoMap = [ ['Ad Block Plus','https://media.geeksforgeeks.org/auth-dashboard-uploads/abp-blocker-min.mp4'], ['Ad Block','https://media.geeksforgeeks.org/auth-dashboard-uploads/Ad-block-min.mp4'], ['uBlock Origin','https://media.geeksforgeeks.org/auth-dashboard-uploads/ub-blocke-min.mp4'], ['uBlock','https://media.geeksforgeeks.org/auth-dashboard-uploads/U-blocker-min.mp4'], ] function handleAdBlockerIconClick(currSelected){ const videocontainer = document.getElementById('ad-blocker-info-div-gif'); const videosource = document.getElementById('ad-blocker-info-div-gif-src'); if(lastSelected != null){ document.getElementById("ad-blocker-info-div-icons-"+lastSelected).style.backgroundColor = "white"; document.getElementById("ad-blocker-info-div-icons-"+lastSelected).style.borderColor = "#D6D6D6"; } document.getElementById("ad-blocker-info-div-icons-"+currSelected).style.backgroundColor = "#D9D9D9"; document.getElementById("ad-blocker-info-div-icons-"+currSelected).style.borderColor = "#848484"; document.getElementById('ad-blocker-info-div-name-span').innerHTML = adBlockerVideoMap[currSelected][0] videocontainer.pause(); videosource.setAttribute('src', adBlockerVideoMap[currSelected][1]); videocontainer.load(); videocontainer.play(); lastSelected = currSelected; }

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences