字符串——打印所有子串

1     public static void printAllSubstring(String[] args) {
2         String s = "asdfs";
3         for(int i=0; i<s.length(); i++) {
4             for(int j=i; j<s.length(); j++) {
5                 System.out.println(s.substring(i, j+1));
6             }
7         }
8     }

 

posted @ 2019-05-03 21:53  往南的小燕子  阅读(928)  评论(0编辑  收藏  举报