Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
30
Task/Substring/Lingo/substring.lingo
Normal file
30
Task/Substring/Lingo/substring.lingo
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
str = "The quick brown fox jumps over the lazy dog"
|
||||
|
||||
-- starting from n characters in and of m length
|
||||
n = 5
|
||||
m = 11
|
||||
put str.char[n..n+m-1]
|
||||
-- "quick brown"
|
||||
|
||||
-- starting from n characters in, up to the end of the string
|
||||
n = 11
|
||||
put str.char[n..str.length]
|
||||
-- "brown fox jumps over the lazy dog"
|
||||
|
||||
-- whole string minus last character
|
||||
put str.char[1..str.length-1]
|
||||
-- "The quick brown fox jumps over the lazy do"
|
||||
|
||||
-- starting from a known character within the string and of m length
|
||||
c = "x"
|
||||
m = 7
|
||||
pos = offset(c, str)
|
||||
put str.char[pos..pos+m-1]
|
||||
-- "x jumps"
|
||||
|
||||
-- starting from a known substring within the string and of m length
|
||||
sub = "fox"
|
||||
m = 9
|
||||
pos = offset(sub, str)
|
||||
put str.char[pos..pos+m-1]
|
||||
-- "fox jumps"
|
||||
Loading…
Add table
Add a link
Reference in a new issue