Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
31
Task/Substring/Pascal/substring-1.pas
Normal file
31
Task/Substring/Pascal/substring-1.pas
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
program substring(output);
|
||||
var
|
||||
sample: string(20) value 'Foobar';
|
||||
n, m: integer value 1;
|
||||
begin
|
||||
{ starting from n characters in and of m length - - - - - - - - - - - - - - - }
|
||||
writeLn(subStr(sample, n, m));
|
||||
writeLn(subStr(sample, n):m);
|
||||
writeLn(sample[n .. n + m - 1]);
|
||||
|
||||
{ starting from n characters in, up to the end of the string - - - - - - - - }
|
||||
writeLn(subStr(sample, n));
|
||||
writeLn(sample[n .. length(sample)]);
|
||||
|
||||
{ whole string minus the last character - - - - - - - - - - - - - - - - - - - }
|
||||
writeLn(subStr(sample, 1, length(sample) - 1));
|
||||
writeLn(sample[1 .. pred(length(sample))]);
|
||||
writeLn(sample:length(sample) - 1);
|
||||
{ To make this a permanent change you can use
|
||||
writeStr(sample, sample:pred(length(sample)); }
|
||||
|
||||
{ starting from a known character within the string and of m length - - - - - }
|
||||
writeLn(subStr(sample, index(sample, 'b'), m));
|
||||
writeLn(subStr(sample, index(sample, 'b')):m);
|
||||
writeLn(sample[index(sample, 'b') .. index(sample, 'b') + m - 1]);
|
||||
|
||||
{ starting from a known substring within the string and of m length - - - - - }
|
||||
writeLn(subStr(sample, index(sample, 'bar'), m));
|
||||
writeLn(subStr(sample, index(sample, 'bar')):m);
|
||||
writeLn(sample[index(sample, 'bar') .. index(sample, 'bar') + m - 1]);
|
||||
end.
|
||||
1
Task/Substring/Pascal/substring-2.pas
Normal file
1
Task/Substring/Pascal/substring-2.pas
Normal file
|
|
@ -0,0 +1 @@
|
|||
var myBindableStringVariable: bindable string(20);
|
||||
1
Task/Substring/Pascal/substring-3.pas
Normal file
1
Task/Substring/Pascal/substring-3.pas
Normal file
|
|
@ -0,0 +1 @@
|
|||
myBindableStringVariable[firstCharacterIndex .. lastCharacterIndex]
|
||||
1
Task/Substring/Pascal/substring-4.pas
Normal file
1
Task/Substring/Pascal/substring-4.pas
Normal file
|
|
@ -0,0 +1 @@
|
|||
write(sample:pred(length(sample), ord(length(sample) > 0))); { all but last char }
|
||||
Loading…
Add table
Add a link
Reference in a new issue