String Programs
- Create empty string Python Tutorial to create an empty string using single quotes, double quotes, or str() builtin function.
- Create string using single quotes Python Tutorial to create a string by enclosing the value in single quotes.
- Create string using double quotes Python Tutorial to create a string by enclosing the value in double quotes.
- Check if String Ends with a Specific Suffix Python Tutorial to check if the given string ends with a specified suffix string.
- Check if String Starts with a Specific Prefix Python Tutorial to check if the given string starts with a specified prefix string.
- Convert string to a list of characters Python Tutorial to convert string to a list of characters.
- Count Number of occurrences of a Substring Python Tutorial to count the number of occurrences of a substring in the given string.
- Escape single quote in a string Python Tutorial to escape a single quote when the string is created using single quotes.
- Escape double quote in a string Python Tutorial to escape a double quote when the string is created using double quotes.
- Find Smallest String based on Length Python Tutorial to find the smallest string among the given strings, based on string length, using min() builtin function.
- Find the Smallest of Strings Lexicographically Python Tutorial to find the smallest string among the given strings lexicographically, i.e., based on arrangement in a dictionary order, using min() builtin function.
- Get character at specific index from string Python Tutorial to get character from string at specified index.
- Get first character from string Python Tutorial to get the first character from string using square brackets notation and 0 index.
- Get last character from string Python Tutorial to get the last character from string using square brackets notation.
- Iterate over characters of a string Python Tutorial to iterate over the characters of a string using For loop.
- Length of String Python Tutorial to get the number of characters in a given string.
- Print unique characters of a string Python Tutorial to get unique characters present in a string, and print them.
- Replace Substring in String Python Tutorial to to replace a specific substring in the given string with another new replacement string.
- Sort List of Strings Python Tutorial to sort the given list of strings in ascending or descending order.
- Split String Python Tutorial to split the given string by a delimiter string.
- Strip or Trim a String Python Tutorial to trim a string at the edges. We can trim whitespaces or any specific set of characters from the edges of the given string.
- Find Substring Python Tutorial to find the substring in the given string, from a specific starting position to end position.
- Write String to Text File Python Tutorial to write given string to a text file.