Andoza:Str sub new/doc: Versiyalar orasidagi farq
Oʻzbekcha Vikipediyadan import qilindi. | Oʻzbekcha Vikipediyadan import qilindi. |
$2, $3 dagi (joriy) koʻrinishi
| Ushbu sahifa Str sub new andozasining hujjat sahifasidir. Bu yerda andozaning asosiy sahifasidan joy olmagan foydalanish qoidalari, turkumlar va boshqa foydali maʼlumotlar joylashtiriladi. |
| Bu andoza quyidagi Luadan foydalanadi: |
This template selects a sub-string from the target string based on selected indices. The indices are 1-based. If the end index is omitted, it returns the rest of the string. One can also specify negative indices, in which case the substr is selected by counting from the end of the string.
Usage
[tahrir | manbasini tahrirlash]{{str sub new|target_string|start_index|end_index}}{{str sub new|s=target_string|i=start_index|j=end_index}}
Examples
[tahrir | manbasini tahrirlash]Unnamed parameters
[tahrir | manbasini tahrirlash]{{str sub new|1234567890|3|7}}
- 34567
{{str sub new|1234567890|3|-3}}
- 345678
{{str sub new|1234567890|3}}
- 34567890
{{str sub new|1234567890|12}}
- String Module Error: String subset index out of range
Named parameters
[tahrir | manbasini tahrirlash]{{Str sub new|s=abcd=fgh|i=3|j=7}}
- cd=fg
Equivalent to:
{{#invoke:string|sub|s=abcd=fgh|i=3|j=7}}
- cd=fg
Named parameters are required if the target string contains an equals sign, where unnamed or numbered parameters will not work as expected:
{{str sub new|abcd=fgh|3|7}}
- String Module Error: String subset index out of range
{{str sub new|1=abcd=fgh|2=3|3=7}}
- cd=fg
See also
[tahrir | manbasini tahrirlash]- {{Str sub old}}
Andoza:String-handling templates