String与Array
生活随笔
收集整理的這篇文章主要介紹了
String与Array
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
public class Api {@Testpublic void StringApi(){// equals() 判斷內(nèi)容是否相同區(qū)分大小寫// equalsIgnoreCase() 判斷內(nèi)容是否相同不區(qū)分大小寫// length() 獲取長度// charAt(int index) 獲取某個索引位置的字符// toCharArray() 字符串轉(zhuǎn)換為字符數(shù)組// substring(int beginIndex,int endIndex) 截取內(nèi)容,包前不包后// substring(int beginIndex) 從當前索引一直截取// replace(CharSequence targer,CharSequence replacement) 對文字進行替換// contains(CharSequence s) 判斷字符中是否存在// starsWiths(String prefix) 已什么字符開始// split(String s) 分割}@Testpublic void ArraryApi(){// add() 添加一個元素在數(shù)組的最后一位// get() 獲取某個索引下的元素值// size() 獲取集合的個數(shù)// remove(int index) 刪除某個索引位置下的元素值,并返回被刪除的元素值// remove(Object o) 直接刪除元素值,返回布爾值// set(int index,E element) 修改某個位置的元素值,返回修改前的值//}}
總結(jié)
以上是生活随笔為你收集整理的String与Array的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java面向对象:异常处理 —(18)
- 下一篇: 前端学习资料及路线名称网站