Leetcode:旋转字符串,String相关用法

//查找字符串中下标为index的字符,返回一个字符:
System.out.println("student".charAt(0)); //输出:s

//按照字典顺序比较两个字符串大小:
System.out.println("abc".compareTo("abc")); //输出:0

//判断前面的字符串是否包含后面的字字符串:
System.out.println("hello World".contains("hello")); //输出:true

public String trim()
//去除字符串前后的空格。
public boolean startsWith(String prefix)
//判断当前字符串是否以prefix字符串开头。

public boolean endsWith(String suffix)
//判断当前字符串是否以suffix字符串开结尾。
public int indexOf(String str)
//返回某个子字符串在当前字符串中第一次出现的下标,没有就返回-1。

publi

Leetcode:旋转字符串,String相关用法最先出现在Python成神之路

版权声明:
作者:Zad
链接:https://www.techfm.club/p/17653.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>