الفرق بين المراجعتين ل"Kotlin/kotlin.text/toSortedSet"

من موسوعة حسوب
اذهب إلى التنقل اذهب إلى البحث
(أنشأ الصفحة ب'<noinclude>{{DISPLAYTITLE: التابع text.toSortedSet()‎ في لغة Kotlin}}</noinclude> تعيد الدالة <code>toSortedSet()</code>‎ Kotlin/Set|مجمو...')
 
سطر 1: سطر 1:
 
<noinclude>{{DISPLAYTITLE: التابع text.toSortedSet()‎ في لغة Kotlin}}</noinclude>
 
<noinclude>{{DISPLAYTITLE: التابع text.toSortedSet()‎ في لغة Kotlin}}</noinclude>
تعيد الدالة <code>toSortedSet()</code>‎ [[Kotlin/Set|مجموعة]] من النوع <code>Set</code> تحتوي كل حروف [[Kotlin/CharSequence/index|سلسلة الحروف]]  التي استٌدعيت عبرها.
+
تعيد الدالة <code>toSortedSet()</code>‎ مجموعة من النوع <code>SortedSet</code> تحتوي كل حروف [[Kotlin/CharSequence/index|سلسلة الحروف]]  التي استٌدعيت عبرها.
 
 
[[Kotlin/Set|المجموعة]] المُعادة تحافظ على ترتيب التكرار (element iteration order) في  [[Kotlin/CharSequence/index|سلسلة الحروف]] الأصلية.
 
 
==البنية العامة==
 
==البنية العامة==
 
<syntaxhighlight lang="kotlin">
 
<syntaxhighlight lang="kotlin">
fun CharSequence.toSet(): Set<Char>  
+
fun CharSequence.toSortedSet(): SortedSet<Char>  
</syntaxhighlight>
+
 
 +
</syntaxhighlight>'''بيئة التشغيل المطلوبة: JVM'''
 +
 
 
==القيم المعادة==
 
==القيم المعادة==
[[Kotlin/Set|مجموعة]] من النوع <code>Set</code>.
+
مجموعة من النوع <code>SortedSet.</code>
 
==أمثلة==
 
==أمثلة==
 
===استخدام الدالة <code>toSortedSet()‎</code> مع السلاسل النصية===
 
===استخدام الدالة <code>toSortedSet()‎</code> مع السلاسل النصية===
 
تستدعي الشيفرة الآتية الدالة <code>toSortedSet()‎</code> عبر عدة [[Kotlin/String|سلاسل نصية]]، وتطبع الناتج:<syntaxhighlight lang="kotlin">
 
تستدعي الشيفرة الآتية الدالة <code>toSortedSet()‎</code> عبر عدة [[Kotlin/String|سلاسل نصية]]، وتطبع الناتج:<syntaxhighlight lang="kotlin">
 
fun main(args: Array<String>) {
 
fun main(args: Array<String>) {
     println("Hello, world!".toSet()) // [H, e, l, o, ,,  , w, r, d, !]
+
     println("Hello, world!".toSortedSet()) // [ , !, ,, H, d, e, l, o, r, w]
     println("Hsoub".toSet()) // [H, s, o, u, b]
+
     println("Hsoub".toSortedSet()) // [H, b, o, s, u]
     println("114".toSet()) // [1, 4]
+
     println("114".toSortedSet()) // [1, 4]
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
سطر 30: سطر 30:
 
*<code>[[Kotlin/text/isDefined|isDefined()]]‎</code>: تعيد القيمة <code>true</code> في حال كان الحرف (Unicode code point) الذي استٌدعيت عبره مُعرّفًا في اليونيكود (Unicode).
 
*<code>[[Kotlin/text/isDefined|isDefined()]]‎</code>: تعيد القيمة <code>true</code> في حال كان الحرف (Unicode code point) الذي استٌدعيت عبره مُعرّفًا في اليونيكود (Unicode).
 
==مصادر==
 
==مصادر==
*[http://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-set.html صفحة الدالة text.toSortedSet()‎ في التوثيق الرسميّ للمكتبة القياسيّة في لغة Kotlin.]
+
*[http://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-sorted-set.html صفحة الدالة text.toSortedSet()‎ في التوثيق الرسميّ للمكتبة القياسيّة في لغة Kotlin.]
 
[[تصنيف:Kotlin]]
 
[[تصنيف:Kotlin]]
 
[[تصنيف:Kotlin Method]]
 
[[تصنيف:Kotlin Method]]

مراجعة 19:07، 13 يوليو 2018

تعيد الدالة toSortedSet()‎ مجموعة من النوع SortedSet تحتوي كل حروف سلسلة الحروف  التي استٌدعيت عبرها.

البنية العامة

fun CharSequence.toSortedSet(): SortedSet<Char>

بيئة التشغيل المطلوبة: JVM

القيم المعادة

مجموعة من النوع SortedSet.

أمثلة

استخدام الدالة toSortedSet()‎ مع السلاسل النصية

تستدعي الشيفرة الآتية الدالة toSortedSet()‎ عبر عدة سلاسل نصية، وتطبع الناتج:

fun main(args: Array<String>) {
    println("Hello, world!".toSortedSet()) // [ , !, ,, H, d, e, l, o, r, w]
    println("Hsoub".toSortedSet()) // [H, b, o, s, u]
    println("114".toSortedSet()) // [1, 4]
}

انظر أيضًا

  • toDouble()‎ : تحلّل الدالة toDouble()‎ السلسلة النصية التي استٌدعيت عبرها وتحوّلها إلى عدد من النوع Double وتعيد الناتج.
  • toUpperCase()‎ : تحوّل الدالة toUpperCase()‎ الحرف أو السلسلة النصية التي استٌدعيت عبرها إلى حالة الأحرف الكبيرة (uppercase).
  • isDefined(): تعيد القيمة true في حال كان الحرف (Unicode code point) الذي استٌدعيت عبره مُعرّفًا في اليونيكود (Unicode).

مصادر