Source: http://stackoverflow.com/questions/4679746/time-complexity-of-javas-substring http://stackoverflow.com/questions/16123446/java-7-string-substring-complexity ...
System.out.println(s1.substring(2)); //from 2nd index to last System.out.println(s1.substring(0, 1)); System.out.println(s1.substring(2,4)); //from 2nd index to 4th index ...
本内容遵循CC 4.0 BY-SA版权协议 在 Java 日常开发中,字符串截取是最常用的操作之一。 java.lang.String 类提供的 substring() 方法是实现这一功能的核心。 一、两种常见使用方法 substring() 方法的作用是 ...