Snippets tagged “substring”
23 snippets use this tag.
- Does Python have a string 'contains' substring method?Python
Yes, Python has a string method called str.__contains__() that allows you to check if a string contains another string.
- Get string character by indexJava
In Java, you can get a character at a specific index in a string using the charAt() method of the String class. This method takes an index as an argument and returns the character at that index.
- How do I get the file extension of a file in Java?Java
To get the file extension of a file in Java, you can use the File class and its getName() method to get the file name, and then use the substring() method of the String class to extract the extension from the file name.
- How do I get the file name from a String containing the Absolute file path?Java
To get the file name from a String containing the absolute file path in Java, you can use the following methods:
- How do I get the last character of a string?Java
To get the last character of a string in Java, you can use the charAt() method of the String class, which returns the character at a specific index in the string.
- How to capitalize the first letter of a String in Java?Java
To capitalize the first letter of a string in Java, you can use the toUpperCase method of the java.lang.String class. Here's an example of how you can do this:
- How to Check if a String Contains a Specific Word in PHPPHP
In this short tutorial, we will provide you with the solution to one of the common issues in PHP: how to check whether a string contains a particular word.
- How to Delete the First Character of a String in JavaScriptJavaScript
Read this tutorial and learn some useful information about the methods that are used for deleting the first character of a string in JavaScript easily.
- How to extract a substring using regexJava
To extract a substring from a string using a regular expression in Java, you can use the following steps:
- How to get a substring between two strings in PHP?PHP
You can use the strpos function to find the position of the first occurrence of a substring in a string, and then use the substr function to extract the desired substring.
- How to Get File Extensions with JavaScriptJavaScript
Read this tutorial and learn several useful, fast and simple one-line and extended solutions of extracting file extensions with the help of JavaScript.
- How to Get the First Character of a StringJavaScript
Read this JavaScript tutorial and learn several string methods that are used to retrieve the first character of a string. Choose the best one for you.
- How to Get the Last Characters of a StringJavaScript
Read and learn several easy and simple methods you can use for retrieving the last characters of a JavaScript string. Choose the best method for your case.
- How to remove single character from a String by indexJava
To remove a single character from a string by its index in Java, you can use the StringBuilder.deleteCharAt() method. Here's an example of how to use it:
- How to remove the last character from a string?Java
There are a few ways to remove the last character from a string in Python. Here are three approaches you can use:
- How to Replace a Character at a Particular Index in JavaScriptJavaScript
In this tutorial, you will read and learn detailed information about methods that are used to replace a character at a particular index in JavaScript.
- In java how to get substring from a string till a character c?Java
To get a substring from a string in Java up until a certain character, you can use the indexOf method to find the index of the character and then use the substring method to extract the substring.
- In Java, how do I check if a string contains a substring (ignoring case)?Java
To check if a string contains a substring (ignoring case) in Java, you can use the contains method of the String class and the equalsIgnoreCase method.
- Java - removing first character of a stringJava
To remove the first character of a string in Java, you can use the substring() method of the String class.
- Java: method to get position of a match in a String?Java
To get the position of a match in a String in Java, you can use the indexOf() method of the String class.
- Remove part of string in JavaJava
To remove a part of a string in Java, you can use the replace() method of the String class.
- Replace a character at a specific index in a string?Java
To replace a character at a specific index in a string in Java, you can use the substring() method of the java.lang.
- What is the Difference Between Substr and SubstringJavaScript
Read this JavaScript tutorial and learn about the two String manipulation functions, namely, substr() and substring() methods and difference between them.