Skip to content
Question 31 of 40

Q.If the substring is not present in a string, the INSTR ( ) returns: (A) - 1 (B) 1 (C) NULL (D) 0

Tamil Nadu DgeCBSE Class XII Board 2023MCQ· 1mImportance★★★★★
78% · 31/40 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

Concept understanding — String Functions

String Functions: A First Look

Think of a string as a piece of text — a word, a sentence, a name, or even a single character. In computing, strings are everywhere: your name in a form, a product code in a database, a tweet, a paragraph in a document. String functions are the tools that let you work with that text: cut it, join it, clean it, search inside it, or change its appearance.

You already use these ideas in everyday life. When you take a long sentence and pick out just the first word, you are performing a "substring" operation. When you combine your first name and last name into a full name, you are "concatenating" two strings. When you check whether an email address contains an "@" symbol, you are "searching" within a string. String functions are just these familiar actions, given precise names and made available in software.

The Core Idea

A string function takes one or more strings as input and returns a new string or a piece of information about the string. The function does not change the original string — it produces a result based on it. This is important: the original data stays untouched unless you explicitly replace it.

Note

Strings are treated as sequences of characters. Each character — letter, digit, space, punctuation — occupies a position. In most systems, counting starts at 1 (the first character is position 1), though some languages start at 0. Always check which convention your tool uses.

Common Types of String Functions

1. Changing Case

These functions convert text to uppercase or lowercase. They are useful when you want to compare names or addresses without worrying about whether someone typed "Delhi" or "delhi".

  • UPPER or UCASE: converts all letters to capitals
  • LOWER or LCASE: converts all letters to small letters
  • PROPER or TITLE: capitalises the first letter of each word

2. Extracting Parts of a String

You often need to pull out a specific portion of text — the first name from a full name, the area code from a phone number, the year from a date.

  • LEFT: returns a given number of characters from the start
  • RIGHT: returns a given number of characters from the end
  • MID or SUBSTRING: returns characters starting from a specified position for a specified length

3. Finding and Replacing

These functions let you search inside text and optionally replace what you find.

  • FIND or INSTR: locates the position of one string inside another
  • REPLACE: substitutes all occurrences of a substring with another string
  • TRIM: removes extra spaces from the beginning and end of a string

4. Joining and Splitting

  • CONCAT or the ampersand (&): joins two or more strings end to end
  • SPLIT (in some systems): breaks a string into parts based on a delimiter (like a comma or space)

5. Measuring Length

  • LEN or LENGTH: returns the number of characters in a string

Why They Matter

In any real-world data task — whether you are cleaning a customer list, generating reports, validating user input, or preparing data for analysis — you will work with text. String functions give you the power to:

  • Standardise messy data (e.g., "john", "John", "JOHN" all become "John")
  • Extract meaningful pieces from longer text (e.g., get the domain from an email) …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.