函式方法API

2021-08-17 22:12:58 字數 3448 閱讀 7486

boolean - contains(string str)

如果字串包含特定序列或字元返回true

"fx is great".contains("fx")

true

boolean- endswith(string str)

檢測是否以特定字串結尾

"fx is great".endswith("great")

true

boolean-satrtswith(string regex)

檢測是否以特定字串開頭

"fx is great".startswith("fx")

true

string- concat(string str)

將指定的字串,此字串的末尾。

"fx is great".concat("!!!")

fxis

great!!

!

int- indexof(object o,)

返回從指定位置起,第乙個匹配字串的位置

"fx is excellent in crm"

.indexof("i",7)

16

boolean- isempty()

判斷是否為空

"fx".isempty()

false

int-compareto(object o)

比較,大於比較引數返回1,小於返回-1,等於返回0

2.compareto(3)

-1

int-length()

返回字串長度

"fexiaoke".length()

8

string-replace(string target,string replacement)

替換指定字串

"fexiaoke is great".replace("fexiaoke","fs")

fs is great

list-split(string regx)

將此字串按regex分割為list。

"fx welcome you".split(" ")

[fx, welcome, you]

string-substring(int beginindex,int endindex)

子字串以指定索引處的字元開頭和結尾

"fxiaoke"

.substring(2,5)

iao

boolean-add(,e e)

向集合新增元素

list = [1,2,3]

list.add(4)

boolean-addall(collection
list1 =[1,2,3]

list2 =[4,5]

list1.addall(list2)

void-clear()

清空值

list = [1,2,3]

list.clear()

boolen-contains(object o)

判斷是否包含匹配內容

list.contains(1)

true

boolean-containsall(collection

list = [1,2,3]

list.containsall([1,4])

false

boolean-equals(object o)

判斷是否相等

"1".equals(1)

false

e-get(int index)

獲取集合指定位置元素

list.get(0)

1int-hashcode()

返回此列表的雜湊碼值

list = [1,2,3]

list.hashcode()

30817

indexof-(object 0)

返回指定元素位置

"qweeqwe"

.indexof("w")

1

boolean-isempty()

判斷是否為空

e- remove(int index)

移除指定位置的元素

e- remove(object o)

移除指定元素

boolean-removeall(collection

int-size()

返回集合元素個數

v- putifvbsent(k key,v value)

如果key存在的情況下,在putifvbsent下不會修改

map

map = new hashmap()

map.putifabsent("1",1)

map.putifabsent("2",2)

map.put("1",2)

map.putifabsent("2",3)

print map.tostring()

[1:2, 2:2]

void-clear()

清空map

boolean-containskey(object key)

是否包含key

map

.containskey("3")

false

boolean-containsvalue(object value)

是否包含value

v-get(object key)

以鍵取值

v-put(k key,v value)

存放k-v

void-putall(map m)

存放乙個map

v-remove(object key)

按鍵移除指定k-v,返回移除的key

map.remove("1")

2

boolean-remove(object key, object value)

移除指定的k-v,沒有返回false

map.remove("1",2)

true

int-size()

返回map元素個數

collection- values()

返回所有值的集合

map.values().tostring()

[2,2]

API函式宣告

在vb中,如何宣告函式呢?我想,如果你正在看此文,那麼你絕對能夠回答得出這個問題。以下便是你應該很熟悉的函式宣告 function setfocus byval hwnd as long as long 即,這行 定義了名為setfocus的函式,此函式具有乙個long型資料型別的引數,並按值傳遞 ...

常用 API 函式 選單函式

在指定的選單裡新增乙個選單項 checkmenuitem 複選或撤消複選指定的選單條目 checkmenuradioitem 指定乙個選單條目被複選成 單選 專案 createmenu 建立新選單 createpopupmenu 建立乙個空的彈出式選單 deletemenu 刪除指定的選單條目 de...

API視窗控制代碼函式

findwindow lpclassname,lpwindowname pchar hwnd findwindowex parent hwnd child hwnd classname pchar windowname pchar hwnd getclassname hwnd hwnd lpclas...