字串大小寫轉換java

2021-07-03 22:45:05 字數 1004 閱讀 5977

3.將字串"abcdeabcde"中的大寫字母都變成小寫,再都變成大寫,再將改變後的兩個字串拼接到一起。最後分別輸出這個字串的第乙個和最後乙個字元。

可能使用到的方法:

int codepointat(int index)

char charat(int index)

string touppercase()

string tolowercase()

int compareto(string anotherstring)

string concat(string str)

int indexof(int ch) 

class teststring

}

public charcharat(int index)
返回指定索引處的char值。索引範圍為從0length() - 1。序列的第乙個char值位於索引0處,第二個位於索引1處,依此類推,這類似於陣列索引。

如果索引指定的char值是**項,則返回**項值。

指定者:介面charsequence中的charat

引數:index-char值的索引。

返回:此字串指定索引處的char值。第乙個char值位於索引0處。

丟擲:indexoutofbound***ception- 如果index引數為負或小於此字串的長度。

大小寫轉換 字串

time limit 1000ms memory limit 65536kb problem description 把乙個字串裡所有的大寫字母換成小寫字母,小寫字母換成大寫字母。其他字元保持不變。input 輸入為一行字串,其中不含空格。長度不超過80個字元。output 輸出轉換好的字串。exa...

std string 字串大小寫轉換

該問題歸結為std transform 函式的使用 函式原型 template class inputiterator,class outputiterator,class unaryoperator outputiterator transform inputiterator first1,inp...

php 字串大小寫轉換

mb convert case mb convert case 對字串進行大小寫轉換 mb convert case string str int mode string encoding mb internal encoding 對乙個 string 進行大小寫轉換,轉換模式由 mode 指定。引...