June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
13
Task/Substring/Falcon/substring.falcon
Normal file
13
Task/Substring/Falcon/substring.falcon
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/* created by Aykayayciti Earl Lamont Montgomery
|
||||
April 9th, 2018 */
|
||||
s = "FalconPL is not just a multi-paradign language but also fun"
|
||||
n = 12
|
||||
m = 5
|
||||
|
||||
> "starting from n characters in and of m length: ", s[n:n+m]
|
||||
> "starting from n characters in, up to the end of the string: ", s[n:]
|
||||
> "whole string minus last character: ", s[0:len(s)-1]
|
||||
new_n = s.find("j", 0)
|
||||
> "starting from a known character within the string and of m length: ", s[new_n:new_n+m]
|
||||
new_n = s.find("mu", 0)
|
||||
> "starting from a known character within the string and of m length: ", s[new_n:new_n+m]
|
||||
|
|
@ -3,7 +3,7 @@ n <- 2; m <- 2; char <- 'd'; chars <- 'cd'
|
|||
substring(s, n, n + m)
|
||||
substring(s, n)
|
||||
substring(s, 1, nchar(s)-1)
|
||||
indx <- which(strsplit(s, '')[[1]]%in%strsplit(char, '')[[1]])
|
||||
indx <- which(strsplit(s, '')[[1]] %in% strsplit(char, '')[[1]])
|
||||
substring(s, indx, indx + m)
|
||||
indx <- which(strsplit(s, '')[[1]]%in%strsplit(chars, '')[[1]])[1]
|
||||
indx <- which(strsplit(s, '')[[1]] %in% strsplit(chars, '')[[1]])[1]
|
||||
substring(s, indx, indx + m)
|
||||
|
|
|
|||
20
Task/Substring/Rust/substring.rust
Normal file
20
Task/Substring/Rust/substring.rust
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
let s = "abc文字化けdef";
|
||||
let n = 2;
|
||||
let m = 3;
|
||||
|
||||
// Print 3 characters starting at index 2 (c文字)
|
||||
println!("{}", s.chars().skip(n).take(m).collect::<String>());
|
||||
|
||||
// Print all characters starting at index 2 (c文字化けdef)
|
||||
println!("{}", s.chars().skip(n).collect::<String>());
|
||||
|
||||
// Print all characters except the last (abc文字化けde)
|
||||
println!("{}", s.chars().rev().skip(1).collect::<String>());
|
||||
|
||||
// Print 3 characters starting with 'b' (bc文)
|
||||
let cpos = s.find('b').unwrap();
|
||||
println!("{}", s[cpos..].chars().take(m).collect::<String>());
|
||||
|
||||
// Print 3 characters starting with "けd" (けde)
|
||||
let spos = s.find("けd").unwrap();
|
||||
println!("{}", s[spos..].chars().take(m).collect::<String>());
|
||||
13
Task/Substring/Stata/substring.stata
Normal file
13
Task/Substring/Stata/substring.stata
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
s = "Ἐν ἀρχῇ ἐποίησεν ὁ θεὸς τὸν οὐρανὸν καὶ τὴν γῆν"
|
||||
|
||||
usubstr(s, 25, 11)
|
||||
τὸν οὐρανὸν
|
||||
|
||||
usubstr(s, 25, .)
|
||||
τὸν οὐρανὸν καὶ τὴν γῆν
|
||||
|
||||
usubstr(s, 1, ustrlen(s)-1)
|
||||
Ἐν ἀρχῇ ἐποίησεν ὁ θεὸς τὸν οὐρανὸν καὶ τὴν γῆ
|
||||
|
||||
usubstr(s, -3, .)
|
||||
γῆν
|
||||
Loading…
Add table
Add a link
Reference in a new issue