The example of this article tells the method of Java intercepting string. Share it for everyone for your reference. The specific implementation method is as follows:
Public Static Void Main (String ARGS []) {// The first appears with this character, and starts to intercept // string str = "abc.def"; // string str = "abc.def.sdfsdf.fsdddddddddddd. ggggg.ttttt "; // string str1 = str.substring (str.indexof (". ")+1, str.Length ()); // The last time the character appeared, began to intercept string str =" http: //wxj.videocc.net/wxj/images/2014/12/i3jwci4j.jpg "; string str1 = str.substring (str.lastindexof ("/"); // 5 characters // string str = "http://wxj.videocc.net/wxj/images/2014/12/i3jwci4j.jpg"; // string str1 = str.Substring (str.length () -5 5, str .length ()); System.out.println (str1);}
It is hoped that this article is helpful to everyone's Java program design.