BUCL.io / substr
Schneidet einen Teiltext aus einem Text heraus.
Beispiel
{res} substr 0 3 "AAAaaa"
Quellcode
#substr #description: Cut a part of a text. #description-DE: Schneidet einen Teiltext aus einem Text heraus. #sample: {res} substr 0 3 "AAAaaa" #to test direct: {input} = 0 3 "AAAaaa" {start} = {input/0} {end} = {input/1} {text} slice 2 0 {input} {textLength} length {text} {res} = "" if {start} < 0 {start} math {textLength}{start} {loop} repeat {textLength} if {loop/index} >= {start} if {end} = 0 {res} = "{res}{text/0/{loop/index}}" elseif {end} < 0 {lastPos} math "{textLength}{end}" if {loop/index} < {lastPos} {res} = "{res}{text/0/{loop/index}}" else if {loop/index} < {end} {res} = "{res}{text/0/{loop/index}}" {output} = {res}