Oracle字串擷取和大小寫轉換

2021-06-29 11:41:00 字數 873 閱讀 1822

1、擷取長度

substr(字串,擷取開始位置,擷取長度) //返回擷取的字

例如:update tablea set cola=substr(cola,instr(cola,'$')+1) where cola like '%$%';

2、sql中實現indexof和lastindexof功能

instr的第三個引數為1時,實現的是indexof功能。

instr的第三個引數為-1時,實現的是lastindexof功能。

例如:instr('wenjin_文進_李_浩dsf', '_', -1, 1)

回結果為:12

instr('wenjin_文進_李_浩dsf', '_', 1, 1)

返回結果為:7

3、oracle,字母大小寫轉換 函式:upper()

功能:將字串中的小寫字母轉換為大寫字母。

語法:upper( string )

引數string:要將其中的小寫字母轉換為大寫字母的字串返回值string。函式執行成功時返回將小寫字母轉換為大寫字母後的字串,發生錯誤時返回空字串("")。如果string引數的值為null,upper()函式返回null。

更新table表的name列為大寫:

update table set name = upper(name);

在程式中實現大寫查詢:

select * from table where name=upper('admin');

在程式中實現大小寫忽略查訓:

select * from table where upper(name)=upper('admin');

大小寫轉換 字串

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...

字串大小寫轉換java

3.將字串 abcdeabcde 中的大寫字母都變成小寫,再都變成大寫,再將改變後的兩個字串拼接到一起。最後分別輸出這個字串的第乙個和最後乙個字元。可能使用到的方法 int codepointat int index char charat int index string touppercase ...