الفرق بين المراجعتين ل"Kotlin/kotlin.text/toHashSet"
< Kotlin | kotlin.text
اذهب إلى التنقل
اذهب إلى البحث
(أنشأ الصفحة ب'<noinclude>{{DISPLAYTITLE: التابع text.toHashSet() في لغة Kotlin}}</noinclude> تحلّل الدالة <code>toHashSet()</code> Kotlin/String|السل...') |
جميل-بيلوني (نقاش | مساهمات) ط |
||
(3 مراجعات متوسطة بواسطة مستخدمين اثنين آخرين غير معروضة) | |||
سطر 1: | سطر 1: | ||
− | <noinclude>{{DISPLAYTITLE: | + | <noinclude>{{DISPLAYTITLE: الدالة <code>toHashSet()</code> في Kotlin}}</noinclude> |
− | + | تعيد الدالة <code>toHashSet()</code> كائنًا من النوع <code>HashSet</code> يحوي كل محارف [[Kotlin/CharSequence/index|السلسلة]] التي استٌدعيت معها. | |
− | |||
− | |||
== البنية العامة == | == البنية العامة == | ||
<syntaxhighlight lang="kotlin"> | <syntaxhighlight lang="kotlin"> | ||
− | + | fun CharSequence.toHashSet(): HashSet<Char> | |
− | |||
− | < | ||
+ | </syntaxhighlight> | ||
== القيم المعادة == | == القيم المعادة == | ||
− | + | يعاد كائن من النوع <code>HashSet</code> يحوي كل محارف [[Kotlin/CharSequence/index|السلسلة]] المعطاة. | |
== أمثلة == | == أمثلة == | ||
− | + | مثالٌ<nowiki/> على استعمال الدالة <code>toHashSet()</code>:<syntaxhighlight lang="kotlin"> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
fun main(args: Array<String>) { | fun main(args: Array<String>) { | ||
− | println(" | + | println("hsoub".toHashSet()) // [h, b, s, u, o] |
+ | println("32.87".toHashSet()) // [8, 2, 3, ., 7] | ||
+ | println("wiki".toHashSet()) // [i, k, w] | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== انظر أيضًا == | == انظر أيضًا == | ||
− | * | + | *الدالة [[Kotlin/kotlin.text/toBoolean|<code>toBoolean()</code>]]: تعيد القيمة <code>true</code> إن كانت [[Kotlin/String|السلسلة النصية]] التي استٌدعيت معها تساوي <code>"true"</code> مع تجاهل حالة الأحرف، أو تعيد القيمة <code>false</code>. |
− | * | + | *الدالة [[Kotlin/kotlin.text/toByteArray|<code>toByteArray()</code>]]: ترمز جميع محارف [[Kotlin/String|السلسلة النصية]] التي استٌدعيت معها وفقًا لترميز محدد ثم تضع الناتج في مصفوفة من النوع <code>[[Kotlin/ByteArray|ByteArray]]</code>. |
− | + | *الدالة [[Kotlin/kotlin.text/toCharArray|<code>toCharArray()</code>]]: تضع جميع محارف [[Kotlin/String|السلسلة النصية]] التي استٌدعيت معها في مصفوفة من النوع <code>[[Kotlin/CharArray|CharArray]]</code>، إذ يوضع كل محرف في عنصر. | |
− | *< | + | *الدالة <nowiki/>[[Kotlin/kotlin.text/toCollection|<code>toCollection()</code>]]: تضيف كل محارف <nowiki/>[[Kotlin/CharSequence|السلسلة]] التي استٌدعيت معها إلى المجموعة المتغيرة المُمرّرة إليها. |
− | *<code>[[Kotlin/kotlin.text/ | + | *الدالة [[Kotlin/kotlin.text/toList|<code>toList()</code>]]: تضيف كل محارف [[Kotlin/CharSequence|سلسلة المحارف]] التي استٌدعيت معها إلى [[Kotlin/collections/List|قائمة]]، إذ يوضع كل محرف في عنصر. |
− | + | *الدالة [[Kotlin/text/toLowerCase|<code>toLowerCase()</code>]]: تحول [[Kotlin/Char|المحرف]] أو جميع محارف [[Kotlin/String|السلسلة النصية]] التي استٌدعيت معها إلى محارف صغيرة (lowercase). | |
− | * | + | *الدالة [[Kotlin/kotlin.text/toMutableList|<code>toMutableList()</code>]]: تضيف كل محارف [[Kotlin/CharSequence|سلسلة المحارف]] التي استٌدعيت معها إلى [[Kotlin/collections/List|قائمة متغيرة]]، إذ يوضع كل محرف في عنصر. |
− | + | *الدالة [[Kotlin/kotlin.text/toPattern|<code>toPattern()</code>]]: تحول [[Kotlin/String|السلسلة النصية]] التي استٌدعيت معها إلى نمط. | |
+ | *الدالة [[Kotlin/kotlin.text/toRegex|<code>toRegex()</code>]]: تحول [[Kotlin/String|السلسلة النصية]] التي استٌدعيت معها إلى [[Kotlin/kotlin.text/Regex/index|تعبير نمطي]] (regular expression). | ||
+ | *الدالة [[Kotlin/kotlin.text/toSet|<code>toSet()</code>]]: تضيف كل محارف [[Kotlin/CharSequence/index|سلسلة الحروف]] التي استٌدعيت معها إلى مجموعة من النوع <code>[[Kotlin/Set|Set]]</code>، إذ يوضع كل محرف في عنصر. | ||
+ | *الدالة [[Kotlin/kotlin.text/toSortedSet|<code>toSortedSet()</code>]]: تضيف كل محارف [[Kotlin/CharSequence|السلسلة]] التي استٌدعيت معها إلى مجموعة من النوع <code>[[Kotlin/collections/SortedSet|SortedSet]]</code>، إذ يوضع كل محرف في عنصر. | ||
+ | *الدالة [[Kotlin/kotlin.text/toString|<code>toString()</code>]] : تحول العدد الذي استٌدعي معها وفقًا لأساس مُحدّد إلى [[Kotlin/String|سلسلة نصية]]. | ||
== مصادر == | == مصادر == | ||
− | * [http://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to- | + | * [http://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-hash-set.html صفحة الدالة toHashSet() في التوثيق الرسميّ للمكتبة القياسيّة في لغة Kotlin.] |
[[تصنيف:Kotlin]] | [[تصنيف:Kotlin]] | ||
− | [[تصنيف:Kotlin | + | [[تصنيف:Kotlin Function]] |
+ | [[تصنيف:Kotlin Text]] |
المراجعة الحالية بتاريخ 11:42، 6 سبتمبر 2018
تعيد الدالة toHashSet()
كائنًا من النوع HashSet
يحوي كل محارف السلسلة التي استٌدعيت معها.
البنية العامة
fun CharSequence.toHashSet(): HashSet<Char>
القيم المعادة
يعاد كائن من النوع HashSet
يحوي كل محارف السلسلة المعطاة.
أمثلة
مثالٌ على استعمال الدالة toHashSet()
:
fun main(args: Array<String>) {
println("hsoub".toHashSet()) // [h, b, s, u, o]
println("32.87".toHashSet()) // [8, 2, 3, ., 7]
println("wiki".toHashSet()) // [i, k, w]
}
انظر أيضًا
- الدالة
toBoolean()
: تعيد القيمةtrue
إن كانت السلسلة النصية التي استٌدعيت معها تساوي"true"
مع تجاهل حالة الأحرف، أو تعيد القيمةfalse
. - الدالة
toByteArray()
: ترمز جميع محارف السلسلة النصية التي استٌدعيت معها وفقًا لترميز محدد ثم تضع الناتج في مصفوفة من النوعByteArray
. - الدالة
toCharArray()
: تضع جميع محارف السلسلة النصية التي استٌدعيت معها في مصفوفة من النوعCharArray
، إذ يوضع كل محرف في عنصر. - الدالة
toCollection()
: تضيف كل محارف السلسلة التي استٌدعيت معها إلى المجموعة المتغيرة المُمرّرة إليها. - الدالة
toList()
: تضيف كل محارف سلسلة المحارف التي استٌدعيت معها إلى قائمة، إذ يوضع كل محرف في عنصر. - الدالة
toLowerCase()
: تحول المحرف أو جميع محارف السلسلة النصية التي استٌدعيت معها إلى محارف صغيرة (lowercase). - الدالة
toMutableList()
: تضيف كل محارف سلسلة المحارف التي استٌدعيت معها إلى قائمة متغيرة، إذ يوضع كل محرف في عنصر. - الدالة
toPattern()
: تحول السلسلة النصية التي استٌدعيت معها إلى نمط. - الدالة
toRegex()
: تحول السلسلة النصية التي استٌدعيت معها إلى تعبير نمطي (regular expression). - الدالة
toSet()
: تضيف كل محارف سلسلة الحروف التي استٌدعيت معها إلى مجموعة من النوعSet
، إذ يوضع كل محرف في عنصر. - الدالة
toSortedSet()
: تضيف كل محارف السلسلة التي استٌدعيت معها إلى مجموعة من النوعSortedSet
، إذ يوضع كل محرف في عنصر. - الدالة
toString()
: تحول العدد الذي استٌدعي معها وفقًا لأساس مُحدّد إلى سلسلة نصية.