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

من موسوعة حسوب
اذهب إلى التنقل اذهب إلى البحث
(أنشأ الصفحة ب'<noinclude>{{DISPLAYTITLE: التابع Appendable.append()‎ في لغة Kotlin}}</noinclude> تعيد الدالة <code>append()</code>‎ القيمة <code>true</c...')
 
سطر 1: سطر 1:
 
<noinclude>{{DISPLAYTITLE: التابع Appendable.append()‎ في لغة Kotlin}}</noinclude>
 
<noinclude>{{DISPLAYTITLE: التابع Appendable.append()‎ في لغة Kotlin}}</noinclude>
تعيد الدالة <code>append()</code>‎ القيمة <code>true</code> في حال كان [[Kotlin/Char/index|الحرف]] (character) الذي استٌدعيت عبره حرفًا أبجديًا.
+
تضم الدالة <code>append()</code>‎ كائنا من النوع <code>[[Kotlin/kotlin.text/Appendable/index|Appendable]]</code> إلى الكائن المُمرّر.
 
== البنية العامة ==
 
== البنية العامة ==
 
<syntaxhighlight lang="kotlin">
 
<syntaxhighlight lang="kotlin">
inline fun Char.isLetter(): Boolean
+
abstract actual fun append(csq: CharSequence?): Appendable
  
</syntaxhighlight>يُلاحَظ وجود الكلمة المفتاحية <code>inline</code> للدلالة على أن هذه الدالة مباشرة، وللمزيد من التفاصيل راجع <nowiki/>[[Kotlin/inline functions|توثيق الدوال المباشرة (inline functions)]].
+
abstract actual fun append(
 +
    csq: CharSequence?,
 +
    start: Int,
 +
    end: Int
 +
): Appendable
 +
 
 +
abstract actual fun append(c: Char): Appendable
 +
 
 +
 
 +
</syntaxhighlight>'''بيئة التشغيل المطلوبة: JS'''
 
== القيم المعادة ==
 
== القيم المعادة ==
قيمة منطقية.
+
كائن من النوع <code>[[Kotlin/kotlin.text/Appendable/index|Appendable]].</code>
  
 
== أمثلة ==
 
== أمثلة ==
  
=== استخدام الدالة <code>append()‎</code> مع الحروف ===
+
=== استخدام الدالة <code>append()‎</code> ===
تُعرّف الشيفرة الآتية [[Kotlin/Char/index|حرفين]] <code>x</code> و <code>y</code> ثم تستدعي الدالة <code>isLetter()‎</code> عبرهما، ثم تطبع الناتج:<syntaxhighlight lang="kotlin">
+
تُعرّف الشيفرة الآتية [[Kotlin/Char/index|سلسلتين نصيتين]] باسم <code>str1</code> و <code>str2،</code> ثم تنشئ كائنا من النوع <code>[[Kotlin/kotlin.text/Appendable/index|Appendable]]</code> باستخدام الدالة  <code>StringBuilder()‎</code>باسم <code>str</code>، ثم تستدعي الدالة <code>append()‎</code> عبرها، ثم تطبع الناتج:<syntaxhighlight lang="kotlin">
fun main(args: Array<String>) {  
+
fun main(args: Array<String>) {
     val x = 'a'
+
     val str1 = "hsoub"
     val y = '9'
+
    val str2 = "academy"   
 +
     val str = StringBuilder()
 +
   
 +
    str.append(str1).append(str2)
 
      
 
      
print(x.isLetter()) // true
+
     print(str) // hsoubacademy
     print(y.isLetter()) // false
 
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
 
== انظر أيضًا ==
 
== انظر أيضًا ==
* <code>[[Kotlin/text/isIdentifierIgnorable|isIdentifierIgnorable()]]‎</code>: تعيد القيمة <code>true</code> في حال كان الحرف الذي استٌدعيت عبره يجب أن يُهمل في مُعرِّفات جافا (Java identifier) أو اليونيكود.
+
* صفحة النوع<code>[[Kotlin/kotlin.text/Appendable/index|Appendable]]</code> <code>‎</code>.
* <code>[[Kotlin/text/isHighSurrogate|isHighSurrogate()]]</code>: تعيد القيمة <code>true</code> في حال كان الحرف الذي استٌدعيت عبره بديلًا علويًا لكود اليونيكود (Unicode high-surrogate code unit).
 
* <code>[[Kotlin/text/isDefined|isDefined()]]‎</code>: تعيد القيمة <code>true</code> في حال كان الحرف (Unicode code point) الذي استٌدعيت عبره مُعرّفًا في اليونيكود (Unicode).
 
  
 
== مصادر ==
 
== مصادر ==
* [https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/is-letter.html صفحة الدالة Appendable.append()‎ في التوثيق الرسميّ للمكتبة القياسيّة في لغة Kotlin.]
+
* [http://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/-appendable/-appendable/append.html صفحة الدالة Appendable.append()‎ في التوثيق الرسميّ للمكتبة القياسيّة في لغة Kotlin.]
 
[[تصنيف:Kotlin]]
 
[[تصنيف:Kotlin]]
 
[[تصنيف:Kotlin Method]]
 
[[تصنيف:Kotlin Method]]

مراجعة 13:29، 4 يوليو 2018

تضم الدالة append()‎ كائنا من النوع Appendable إلى الكائن المُمرّر.

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

abstract actual fun append(csq: CharSequence?): Appendable 

abstract actual fun append(
    csq: CharSequence?, 
    start: Int, 
    end: Int
): Appendable 

abstract actual fun append(c: Char): Appendable

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

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

كائن من النوع Appendable.

أمثلة

استخدام الدالة append()‎

تُعرّف الشيفرة الآتية سلسلتين نصيتين باسم str1 و str2، ثم تنشئ كائنا من النوع Appendable باستخدام الدالة StringBuilder()‎باسم str، ثم تستدعي الدالة append()‎ عبرها، ثم تطبع الناتج:

fun main(args: Array<String>) {
    val str1 = "hsoub"
    val str2 = "academy"    
    val str = StringBuilder()
    	
    str.append(str1).append(str2)
    
    print(str) // hsoubacademy
}

انظر أيضًا

مصادر