تغییر منو
Toggle preferences menu
تغییر منوی شخصی
به سامانه وارد نشده‌اید
نشانی آی‌پی شما در صورت انجام هرگونه ویرایش به صورت عمومی قابل مشاهده خواهد بود.

الگو:Str mid/doc: تفاوت میان نسخه‌ها

از اسلامشناسان
imported>Jdaloner
جز Updated transclusion of navbox.
 
imported>Adminm
جز ۱ نسخه واردشده
 
(بدون تفاوت)

نسخهٔ کنونی تا ۳ مارس ۲۰۱۸، ساعت ۱۹:۳۳

خطای لوا: روند نتوانست ایجاد شود: proc_open(/dev/null): Failed to open stream: Operation not permitted خطای لوا: روند نتوانست ایجاد شود: proc_open(/dev/null): Failed to open stream: Operation not permitted

Usage

Characters in the source string are counted: the first is index ​1​, the last one is index ​length of string​. The substring requested can be defined by these two indexes. Also, the substring can be defined by one index, and the substring length. The options are: {{str mid|<string>|<index of first character>|<length of substring>|<index of last character>}} It returns a part of the <string>, starting with character on position index, length <sublength>, last character returned is end index.

  • {{str mid|Abcdefghijklmnopqrstuvwxyz|5|3}} → خطای عبارت: نویسه نقطه‌گذاری شناخته نشده «۳»

If parameter 2 is omitted, start is from character 1:

  • {{str mid|Abcdefghijklmnopqrstuvwxyz||5}} → خطای عبارت: نویسه نقطه‌گذاری شناخته نشده «۵»

If parameter 3 is omitted, the whole rest of the string is returned:

  • {{str mid|Abcdefghijklmnopqrstuvwxyz|15}} → خطای عبارت: عملگر < دور از انتظار

Counting from the end

By entering a negative value, the index is counted from the end:

  • {{str mid|Abcdefghijklmnopqrstuvwxyz|-7|4}} → خطای عبارت: نویسه نقطه‌گذاری شناخته نشده «۴»
  • {{str mid|Abcdefghijklmnopqrstuvwxyz|-7}} → خطای عبارت: عملگر < دور از انتظار

Instead if substring length, use index for last character

By using parameter |4=n, a number, you do not ask for substring length, but the last character (as counted from the start of the input string):

  • {{str mid|Abcdefghijklmnopqrstuvwxyz|5||7}} → خطای عبارت: عملگر < دور از انتظار

Spaces are kept

In the returned substring, spaces are kept:

  • >{{str mid|I like this.|2|6}}< → >خطای عبارت: نویسه نقطه‌گذاری شناخته نشده «۶»<

But the input string is trimmed:

  • >{{str mid| I like this. |2|6}}< → >خطای عبارت: نویسه نقطه‌گذاری شناخته نشده «۶»<

Error messages

When the ranges (either param2 or the substring length) is out impossible in the string, an error is returned:

  • {{str mid|Abcdefghijklmnopqrstuvwxyz|30}} → خطای عبارت: عملگر < دور از انتظار
  • {{str mid|Abcdefghijklmnopqrstuvwxyz|0|45}} → خطای عبارت: نویسه نقطه‌گذاری شناخته نشده «۴»

The error can be suppressed by using |ignore errors=true. A blank (empty string) will be returned:

  • {{str mid|Abcdefghijklmnopqrstuvwxyz|0|45|ignore errors=true}} → خطای عبارت: نویسه نقطه‌گذاری شناخته نشده «۴»

Error category

  • |no category=true switches off category adding.
  • |error category=[[Category:Your category name]] sets the category to be added when in case of an error.
Default is Category:Errors reported by Module String.

See also

خطای لوا: روند نتوانست ایجاد شود: proc_open(/dev/null): Failed to open stream: Operation not permitted