سلسلة دروس تعليم لغة كوتلن لتعليم الأندرويد – الدرس التاسع
محتويات الدرس :-
- دوال ال String ومثال على كل دالة
- دالة str.plus
- دالة str.hashcode
- دالة str.equals
- دالة str.length
- دالة str.count
- دالة str.drop
- دالة str.removeRange
- دالة str.take
- دالة str.toUpperCase
- دالة str.toLowerCase
- دالة str.first
- دالة str.last
- دالة str.replace

السلاسل النصية في كوتلن
ويقصد بها String وهي عبارة عن قيم نصية تكون ضمن الرمزين ” ” والقيم النصية يمكن ان تشمل الحروف والارقام والرموز وهنا بعض الدوال يتم تطبيقها على الString .
str.plus لأضافة نص جديد مع النص السابق أو دمج مع نص أخر

str.hashCode يجلب الترميز الخاص بالقيمة النصية ك Int

str.equals لمطابقة النص مع نص أخر والتأكد هل هو متشابه او لا ليرجع true or false

str.length معرفة عدد أحرف النص

str.count معرفة عدد أحرف النص كما في دالة length

str.drop يتجاهل او يحذف عدد الأحرف قبل موقع الحرف المطلوب

str.removeRange تقوم بحذف الأحرف حسب المدى المطلوب

str.take يأتي فقط بالأحرف الأولى من النص وحسب العدد المطلوب

str.toUpperCase يحول الأحرف الى أحرف كبيرة

str.toLowerCase يحول الأحرف الى أحرف صغيرة

str.first يأتي بالحرف الأول من النص

str.last ياتي بالحرف الأخير من النص

str.replace دالة مسؤولة عن استبدال حرف بحرف او النص كامل بنص اخر او استبدال جزء من النص بجزء اخر

مثال كامل لكافة دوال ال string

