RosettaCodeData/Task/Substring/Liberty-BASIC/substring.liberty

23 lines
782 B
Plaintext

'These tasks can be completed with various combinations of Liberty Basic's
'built in Mid$()/ Instr()/ Left$()/ Right$()/ and Len() functions, but these
'examples only use the Mid$()/ Instr()/ and Len() functions.
baseString$ = "Thequickbrownfoxjumpsoverthelazydog."
n = 12
m = 5
'starting from n characters in and of m length
Print Mid$(baseString$, n, m)
'starting from n characters in, up to the end of the string
Print Mid$(baseString$, n)
'whole string minus last character
Print Mid$(baseString$, 1, (Len(baseString$) - 1))
'starting from a known character within the string and of m length
Print Mid$(baseString$, Instr(baseString$, "f", 1), m)
'starting from a known substring within the string and of m length
Print Mid$(baseString$, Instr(baseString$, "jump", 1), m)