Template:Str mid

{{str mid/core
 * s=
 * i={{#if:}||{{#ifexpr:({{#if:|1|0}} and {{#if:|1|0}})|{{#expr:0-+{{#ifexpr:<0|-1|1}}}}|1}}}}
 * j={{min||{{#if:||{{#if:|{{#expr:{{#if:||1}}++{{#ifexpr:<0|1|-1}}}}|}}}}}}
 * slen={{#invoke:String|len|{{trim|{{{1|}}}}}}}
 * sublen=0
 * invert={{#ifexpr:{{formatnum:{{#ifeq:||0|{{{3|}}}}}}}<0|yes|no}}
 * triangle check={{#if:|{{#if:{{{3|}}}|{{#if:|{{#ifexpr:((-+1)<>) and ({{{2|}}}*<>0)|Error using Str mid: indexes i={{{2|}}} and j={{{4|}}} do not match requested substring length {{trim|{{{3|}}}}}}}|}}}}}}
 * ignore_errors=
 * error_category=
 * no_category=

}}
 * dbg_in=_IN:_i2=_sublen3=_j4=_min={{min|{{{4|}}}|{{str len|{{trim|{{{1|}}}}}}}}}
 * dbg=no