Home > 类库下载 > java类库 > JAVA Basics String Basic Operations

JAVA Basics String Basic Operations

高洛峰
Release: 2016-10-19 09:28:26
Original
1506 people have browsed it

String str = "str";

str.length(); //3 Returns the length of the string

str.indexOf("s"); //0 Returns the index of s starting from 0; if not, returns -1

str.trim(); //"str" ​​Remove the spaces before and after str

str.substring(0,1); //"s" includes the beginning but not the end

str.charAt(0); // 's' Get the 0th character

str.startsWith("s") //true Whether it starts with s

str.endsWith("r") //true Whether it ends with r

str.toLowerCase() / /Convert all str to lowercase

str.toUpperCase() //Convert all str to uppercase

str.valueOf() //Convert the parameters brought in into string


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template