JavaScript String Search 小教學 | Compbrother Ltd

JavaScript String Search 小教學


Web Design Expert!

Compbrother  @ Web Design : JavaScript String Search 小教學

Publish Date: 2021-12-06

Article Type: Web Design

前文我們了解了 JavaScript Strings字串的一些使用上的小技巧及一些實用功能可使用,但其實JavaScript String自身更設有搜尋Search的功能,為網頁設計和開發人員帶來很方便的編程。

indexOf(查找的String字串): 輸入一個字串,可查找這字串最開始出現的位置。

lastIndexOf(查找的String字串): 輸入一個字串,可查找這字串最後出現的位置。

search(查找的String字串): 輸入一個字串,可查找這字串出現的位置。

includes(查找的String字串): 輸入一個字串,可查找這字串是否曾出現?

startsWith(查找的String字串): 輸入一個字串,可查找這字串是否在最開首時出現?

endsWith(查找的String字串): 輸入一個字串,可查找這字串是否在最尾端時出現?

String字串是非常常見的資料類型(data type),網頁設計編程人員好好把握,可以為網站程式編寫時帶來更快的效率!



If you want the service of Web Design, do contact us immediately!



Contact



Send a Message

Sed diam nonummy nibh euismod tincidunt ut laoreet dolore magnais.