Last active
June 11, 2017 22:22
-
-
Save Bahaaib/64ca0699dae6115f9b5cd824e1df7da6 to your computer and use it in GitHub Desktop.
String Manipulation further more..
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Arrays; | |
| import java.util.Pattern; | |
| import java.util.Matcher; | |
| public class HelloWorld { | |
| public static main (String[] args){ | |
| String mystring = "Mississippi"; | |
| String [] splitter = mystring.split("s"); // to split the phrase to words depends on a specific letter | |
| String riverPart = mystring.substring(2, 5); // to prints the letters starting from letter 2 to 5 "which is not including" | |
| Pattern p = Pattern.compile("Mi(.*?)pi"); // REGEX code to find a pattern of letters | |
| Matcher m = p.Matcher(mystring); | |
| while(m.find()){ | |
| System.out.println(m.group(1)); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment