Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,11 @@
with Ada.Text_IO;
procedure Remove_Characters is
S: String := "upraisers";
use Ada.Text_IO;
begin
Put_Line("Full String: """ & S & """");
Put_Line("Without_First: """ & S(S'First+1 .. S'Last) & """");
Put_Line("Without_Last: """ & S(S'First .. S'Last-1) & """");
Put_Line("Without_Both: """ & S(S'First+1 .. S'Last-1) & """");
end Remove_Characters;

View file

@ -0,0 +1,33 @@
with Ada.Text_IO;
with Ada.Strings.UTF_Encoding.Wide_Strings;
procedure Remove_Characters
is
use Ada.Text_IO;
use Ada.Strings.UTF_Encoding;
use Ada.Strings.UTF_Encoding.Wide_Strings;
S : String := "upraisers";
U : Wide_String := Decode (UTF_8_String'(S));
function To_String (X : Wide_String)return String
is
begin
return String (UTF_8_String'(Encode (X)));
end To_String;
begin
Put_Line
(To_String
("Full String: """ & U & """"));
Put_Line
(To_String
("Without_First: """ & U (U'First + 1 .. U'Last) & """"));
Put_Line
(To_String
("Without_Last: """ & U (U'First .. U'Last - 1) & """"));
Put_Line
(To_String
("Without_Both: """ & U (U'First + 1 .. U'Last - 1) & """"));
end Remove_Characters;

View file

@ -0,0 +1,17 @@
identification division.
program-id. toptail.
data division.
working-storage section.
01 data-field.
05 value "[this is a test]".
procedure division.
sample-main.
display data-field
*> Using reference modification, which is (start-position:length)
display data-field(2:)
display data-field(1:length of data-field - 1)
display data-field(2:length of data-field - 2)
goback.
end program toptail.

View file

@ -0,0 +1,11 @@
str = "abcde"
# String with first character removed
str[1..] #=> "bcde"
str.lchop #=> "bcde"
# String with last character removed
str[..-2] #=> "abcd"
str.rchop #=> "abcd"
# String with both the first and last characters removed
str[1..-2] #=> "bcd"

View file

@ -0,0 +1,4 @@
(let ((string "top and tail"))
(substring string 1) ;=> "op and tail"
(substring string 0 (1- (length string))) ;=> "top and tai"
(substring string 1 (1- (length string)))) ;=> "op and tai"

View file

@ -0,0 +1,15 @@
function strip_first(sequence s)
return s[2..$]
end function
function strip_last(sequence s)
return s[1..$-1]
end function
function strip_both(sequence s)
return s[2..$-1]
end function
puts(1, strip_first("knight")) -- strip first character
puts(1, strip_last("write")) -- strip last character
puts(1, strip_both("brooms")) -- strip both first and last characters

View file

@ -1,6 +1,4 @@
-->
<span style="color: #008080;">constant</span> <span style="color: #000000;">s</span> <span style="color: #0000FF;">=</span> <span style="color: #008000;">"(test)"</span>
<span style="color: #0000FF;">?</span><span style="color: #000000;">s</span><span style="color: #0000FF;">[</span><span style="color: #000000;">2</span><span style="color: #0000FF;">..-</span><span style="color: #000000;">1</span><span style="color: #0000FF;">]</span>
<span style="color: #0000FF;">?</span><span style="color: #000000;">s</span><span style="color: #0000FF;">[</span><span style="color: #000000;">1</span><span style="color: #0000FF;">..-</span><span style="color: #000000;">2</span><span style="color: #0000FF;">]</span>
<span style="color: #0000FF;">?</span><span style="color: #000000;">s</span><span style="color: #0000FF;">[</span><span style="color: #000000;">2</span><span style="color: #0000FF;">..-</span><span style="color: #000000;">2</span><span style="color: #0000FF;">]</span>
<!--
constant s = utf8_to_utf32("(test)")
?utf32_to_utf8(s[2..-1])
?utf32_to_utf8(s[1..-2])
?utf32_to_utf8(s[2..-2])

View file

@ -0,0 +1,7 @@
require "uchar"
local a = uchar.of("Beyoncé")
local b = a:sub(2)
local c = a:sub(1, -2)
local d = c:sub(2)
for {a, b, c, d} as e do print(e) end

View file

@ -0,0 +1,5 @@
$string = "top and tail"
$string
$string.Substring(1)
$string.Substring(0, $string.Length - 1)
$string.Substring(1, $string.Length - 2)

View file

@ -0,0 +1,5 @@
$string = "top and tail"
$string
$string[1..($string.Length - 1)] -join ""
$string[0..($string.Length - 2)] -join ""
$string[1..($string.Length - 2)] -join ""

View file

@ -0,0 +1,8 @@
substring "hello" 1 4
ell
rest "hello"
ello
before-last "world"
worl

View file

@ -0,0 +1,6 @@
fn main() {
words := "(The V Programming Language)"
println("${words.substr(1, words.len)}") // remove first character
println("${words.substr(0, words.len - 1)}") // remove last character
println("${words.runes()[1..words.len - 1].string()}") // remove first and last characters
}

View file

@ -0,0 +1,14 @@
Function TopNTail(s,mode)
Select Case mode
Case "top"
TopNTail = Mid(s,2,Len(s)-1)
Case "tail"
TopNTail = Mid(s,1,Len(s)-1)
Case "both"
TopNTail = Mid(s,2,Len(s)-2)
End Select
End Function
WScript.Echo "Top: UPRAISERS = " & TopNTail("UPRAISERS","top")
WScript.Echo "Tail: UPRAISERS = " & TopNTail("UPRAISERS","tail")
WScript.Echo "Both: UPRAISERS = " & TopNTail("UPRAISERS","both")