JavaScript String ပါဝင်သည်()
ဥပမာများ
စာကြောင်းတွင် "ကမ္ဘာ" ပါဝင်ခြင်း ရှိ၊ မရှိ စစ်ဆေးပါ-
let text = "Hello world, welcome to the universe.";
let result = text.includes("world");
let text = "Hello World, welcome to the universe.";
let result = text.includes("world", 12);
အောက်တွင် နောက်ထပ် ဥပမာများ။
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
စာကြောင်းတစ်ခုတွင် သတ်မှတ်ထားသော စာကြောင်းတစ်ခုပါရှိလျှင် includes()
နည်းလမ်းသည် ပြန်ပေးသည် ။true
မဟုတ်ရင် ပြန်လာမှာပါ false
။
includes()
နည်းလမ်းသည် case sensitive ဖြစ်သည် ။
အထားအသို
string.includes(searchvalue, start)
ကန့်သတ်ချက်များ
Parameter | Description |
searchvalue | Required. The string to search for. |
start | Optional. The position to start from. Default value is 0. |
တန်ဖိုးကို ပြန်ပေးသည်။
ရိုက်ပါ။ | ဖော်ပြချက် |
ဘူလီယန်။ | true string တွင် value ပါနေပါက၊ မဟုတ်လျှင် false ။ |
နောက်ထပ် ဥပမာများ
ရာထူး 12 တွင်စတင်ပါ။
let text = "Hello world, welcome to the universe.";
let result = text.includes("world", 12);
Browser ပံ့ပိုးမှု
includes()
ECMAScript6 (ES6) အင်္ဂါရပ်တစ်ခုဖြစ်သည်။
ES6 (JavaScript 2015) ကို ခေတ်မီဘရောက်ဆာများအားလုံးတွင် ပံ့ပိုးထားပါသည်။
Chrome | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes |
includes()
Internet Explorer 11 (သို့မဟုတ်အစောပိုင်း) တွင် မပံ့ပိုးပါ။