Java常用类(String,File)

来源:互联网 发布:华西炒股软件下载 编辑:程序博客网 时间:2024/05/29 10:31

String类:

char charAt(int index);

int length();

int indexof(String s);

int indexof(String s, int fromIndex);

boolean equalsIgnoreCase(String s);

String replace(char oldChar, char newChar);

boolean startsWith(String s);

boolean endsWith(String s);

String toUpperCase();

String toLowerCase();

String substring(int beginIndex);

String substring(int beginIndex, int endIndex);

String trim();

String[] split("分隔符");


File类:

访问文件属性:

boolean canRead();

boolean canWrite();

boolean exists();

boolean isDirectory();

boolean isFile();

boolean isHidden();

long lastModified();

long length();

String getName();

String getPath();

创建空文件夹或目录:

boolean createNewFile() throws IOException;

boolean delete();

boolean mkdir();

boolean mkdirs();


0 0
原创粉丝点击