Vorlage:Str mid: Unterschied zwischen den Versionen
clean code from notepad
(celanup code) |
(clean code from notepad) |
||
Zeile 1: | Zeile 1: | ||
{{str mid/core | |||
| s={{{1|}}} | |||
| i={{#if:{{{2|}}}}|{{{2|}}}|{{#ifexpr:({{#if:{{{3|}}}|1|0}} and {{#if:{{{4|}}}|1|0}})|{{#expr:{{min|{{{4|}}}|{{str len|{{trim|{{{1|}}}}}}}}}-{{{3|}}}+{{#ifexpr:{{{3|}}}<0|-1|1}}}}|1}}}} | |||
| j={{min|{{#invoke:String|len|{{trim|{{{1|}}}}}}}|{{#if:{{{4|}}}|{{{4|}}}|{{#if:{{{3|}}}|{{#expr:{{#if:{{{2|}}}|{{{2|}}}|1}}+{{{3|}}}+{{#ifexpr:{{{3|}}}<0|1|-1}}}}|}}}}}} | |||
| slen={{#invoke:String|len|{{trim|{{{1|}}}}}}} | |||
| sublen={{formatnum:{{{3|}}}}} | |||
| invert={{#ifexpr:{{formatnum:{{#ifeq:{{{3|}}}||0|{{{3|}}}}}}}<0|yes|no}} | |||
| triangle check={{#if:{{{2|}}}|{{#if:{{{3|}}}|{{#if:{{{4|}}}|{{#ifexpr:(({{{4|}}}-{{{2|0}}}+1)<>{{{3|0}}}) and ({{{2|}}}*{{{4|}}}<>0)|Error using {{tl|Str mid}}: indexes i={{{2|}}} and j={{{4|}}} do not match requested substring length {{trim|{{{3|}}}}}}}|}}}}}} | |||
|ignore_errors={{{ignore errors|false}}} | |||
|error_category={{yesno|{{{error category|}}}|yes={{{error category|}}}}} | |||
|no_category={{{no category|false}}} | |||
|dbg_in=_IN:_i2={{{2|u}}}_sublen3={{{3|u}}}_j4={{{4|u}}}_min={{min|{{{4|}}}|{{str len|{{trim|{{{1|}}}}}}}}} | |||
|dbg=no | |||
}}<noinclude> | |||
* {{tl|Str mid}} | |||
* {{tl|Str mid/core}} | |||
* {{tl|Str mid/testcases}} | |||
{{documentation}} | |||
</noinclude> |