الفرق بين المراجعتين ل"Kotlin/kotlin.text/hasSurrogatePairAt"
< Kotlin | kotlin.text
اذهب إلى التنقل
اذهب إلى البحث
(أنشأ الصفحة ب'<noinclude>{{DISPLAYTITLE: الدالة <code>text.hasSurrogatePairAt()</code> في لغة Kotlin}}</noinclude> تعيد الدالة<code>hasSurrogatePairAt()</co...') |
|||
سطر 1: | سطر 1: | ||
<noinclude>{{DISPLAYTITLE: الدالة <code>text.hasSurrogatePairAt()</code> في لغة Kotlin}}</noinclude> | <noinclude>{{DISPLAYTITLE: الدالة <code>text.hasSurrogatePairAt()</code> في لغة Kotlin}}</noinclude> | ||
− | تعيد الدالة<code>hasSurrogatePairAt()</code> | + | تعيد الدالة<code>hasSurrogatePairAt()</code> القيمة <code>true</code> إن كان لدى [[Kotlin/CharSequence/index|سلسلة الحروف]] التي استُدعيت عبرها زوج يونيكود بديل (Unicode surrogate pair) عند الفهرس المُحدّد. |
− | |||
− | |||
==البنية العامة== | ==البنية العامة== | ||
<syntaxhighlight lang="kotlin"> | <syntaxhighlight lang="kotlin"> | ||
− | + | fun CharSequence.hasSurrogatePairAt(index: Int): Boolean | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | ): | ||
− | |||
− | + | </syntaxhighlight> | |
==القيم المٌعادة== | ==القيم المٌعادة== | ||
− | + | قيمة منطقية. | |
==أمثلة== | ==أمثلة== | ||
− | ===استخدام الدالة <code>()hasSurrogatePairAt</code> مع السلاسل النصية | + | ===استخدام الدالة <code>()hasSurrogatePairAt</code> مع السلاسل النصية=== |
− | تعرِّف الشيفرة الآتية [[Kotlin/String|سلسلة نصية]] باسم <code>str</code>، ثمَّ تستدعي الدالة <code>()hasSurrogatePairAt</code> عبرها مع تمرير | + | تعرِّف الشيفرة الآتية [[Kotlin/String|سلسلة نصية]] باسم <code>str</code>، ثمَّ تستدعي الدالة <code>()hasSurrogatePairAt</code> عبرها مع تمرير عدد كوسيط، ثمَّ تطبع الناتج:<syntaxhighlight lang="kotlin"> |
fun main(args: Array<String>) { | fun main(args: Array<String>) { | ||
− | + | var str = "hsoub" | |
− | + | ||
− | print(str. | + | print(str.hasSurrogatePairAt(1)) //false |
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==انظر أيضًا== | ==انظر أيضًا== | ||
− | * <code>[[Kotlin/ | + | * <code>[[Kotlin/text/isSurrogate|isSurrogate()]]</code>:تعيد القيمة <code>true</code> في حال كان الحرف الذي استٌدعيت عبره بديلًا لكود اليونيكود (Unicode surrogate code unit). |
− | |||
==مصادر== | ==مصادر== | ||
− | *[http://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/ | + | *[http://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/has-surrogate-pair-at.html الدالة text.hasSurrogatePairAt() في التوثيق الرسمي للمكتبة القياسية في لغة Kotlin] |
[[تصنيف:Kotlin]] | [[تصنيف:Kotlin]] | ||
[[تصنيف:Kotlin Functions]] | [[تصنيف:Kotlin Functions]] |
مراجعة 19:11، 9 يوليو 2018
تعيد الدالةhasSurrogatePairAt()
القيمة true
إن كان لدى سلسلة الحروف التي استُدعيت عبرها زوج يونيكود بديل (Unicode surrogate pair) عند الفهرس المُحدّد.
البنية العامة
fun CharSequence.hasSurrogatePairAt(index: Int): Boolean
القيم المٌعادة
قيمة منطقية.
أمثلة
استخدام الدالة ()hasSurrogatePairAt
مع السلاسل النصية
تعرِّف الشيفرة الآتية سلسلة نصية باسم str
، ثمَّ تستدعي الدالة ()hasSurrogatePairAt
عبرها مع تمرير عدد كوسيط، ثمَّ تطبع الناتج:
fun main(args: Array<String>) {
var str = "hsoub"
print(str.hasSurrogatePairAt(1)) //false
}
انظر أيضًا
isSurrogate()
:تعيد القيمةtrue
في حال كان الحرف الذي استٌدعيت عبره بديلًا لكود اليونيكود (Unicode surrogate code unit).