Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
12
Task/Substring/Burlesque/substring-1.blq
Normal file
12
Task/Substring/Burlesque/substring-1.blq
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
blsq ) "RosettaCode"5.+
|
||||
"Roset"
|
||||
blsq ) "RosettaCode"5.+2.-
|
||||
"set"
|
||||
blsq ) "RosettaCode""set"ss
|
||||
2
|
||||
blsq ) "RosettaCode"J"set"ss.-
|
||||
"settaCode"
|
||||
blsq ) "RosettaCode"~]
|
||||
"RosettaCod"
|
||||
blsq ) "RosettaCode"[-
|
||||
"osettaCode"
|
||||
4
Task/Substring/Burlesque/substring-2.blq
Normal file
4
Task/Substring/Burlesque/substring-2.blq
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
blsq ) "RosettaCode"{0 1 3 5}si
|
||||
"Roet"
|
||||
blsq ) "RosettaCode"{0 1 3 5}di
|
||||
"oetaCde"
|
||||
5
Task/Substring/Elixir/substring.elixir
Normal file
5
Task/Substring/Elixir/substring.elixir
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
s = "abcdefgh"
|
||||
String.slice(s, 2, 3) #=> "cde"
|
||||
String.slice(s, 1..3) #=> "bcd"
|
||||
String.slice(s, -3, 2) #=> "fg"
|
||||
String.slice(s, 3..-1) #=> "defgh"
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
my $str = 'abcdefgh';
|
||||
my $n = 2;
|
||||
my $m = 3;
|
||||
print substr($str, $n, $m), "\n";
|
||||
print substr($str, $n), "\n";
|
||||
print substr($str, 0, -1), "\n";
|
||||
print substr($str, index($str, 'd'), $m), "\n";
|
||||
print substr($str, index($str, 'de'), $m), "\n";
|
||||
print substr($str, 2, 3), "\n"; # Returns 'cde'
|
||||
print substr($str, 2), "\n"; # Returns 'cdefgh'
|
||||
print substr($str, 0, -1), "\n"; #Returns 'abcdefg'
|
||||
print substr($str, index($str, 'd'), 3), "\n"; # Returns 'def'
|
||||
print substr($str, index($str, 'de'), 3), "\n"; # Returns 'def'
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ REBOL [
|
|||
Title: "Retrieve Substring"
|
||||
Author: oofoe
|
||||
Date: 2009-12-06
|
||||
URL: http://rosettacode.org/wiki/Retrieve_a_substring
|
||||
URL: http://rosettacode.org/wiki/Substring#REBOL
|
||||
]
|
||||
|
||||
s: "abcdefgh" n: 2 m: 3 char: #"d" chars: "cd"
|
||||
|
|
|
|||
16
Task/Substring/VBScript/substring.vb
Normal file
16
Task/Substring/VBScript/substring.vb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
s = "rosettacode.org"
|
||||
|
||||
'starting from n characters in and of m length
|
||||
WScript.StdOut.WriteLine Mid(s,8,4)
|
||||
|
||||
'starting from n characters in, up to the end of the string
|
||||
WScript.StdOut.WriteLine Mid(s,8,Len(s)-7)
|
||||
|
||||
'whole string minus last character
|
||||
WScript.StdOut.WriteLine Mid(s,1,Len(s)-1)
|
||||
|
||||
'starting from a known character within the string and of m length
|
||||
WScript.StdOut.WriteLine Mid(s,InStr(1,s,"c"),4)
|
||||
|
||||
'starting from a known substring within the string and of m length
|
||||
WScript.StdOut.WriteLine Mid(s,InStr(1,s,"ose"),6)
|
||||
Loading…
Add table
Add a link
Reference in a new issue