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,2 @@
S : String := "12345";
S := Ada.Strings.Fixed.Trim(Source => Integer'Image(Integer'Value(S) + 1), Side => Ada.Strings.Both);

View file

@ -0,0 +1,3 @@
Global $x = "12345"
$x += 1
MsgBox(0,"",$x)

View file

@ -0,0 +1,7 @@
import ballerina/io;
public function main() returns error? {
string s = "1049";
int a = check int:fromString(s);
io:println((a + 1).toString());
}

View file

@ -0,0 +1,14 @@
PROGRAM-ID. increment-num-str.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 str PIC X(5) VALUE "12345".
01 num REDEFINES str PIC 9(5).
PROCEDURE DIVISION.
DISPLAY str
ADD 1 TO num
DISPLAY str
GOBACK
.

View file

@ -0,0 +1,13 @@
PROGRAM-ID. increment-num-str.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 num-str PIC 9(5) VALUE 12345.
PROCEDURE DIVISION.
DISPLAY num-str
ADD 1 TO num-str
DISPLAY num-str
GOBACK
.

View file

@ -0,0 +1 @@
(1+ (string-to-number "12345"))

View file

@ -0,0 +1,12 @@
include get.e
function val(sequence s)
sequence x
x = value(s)
return x[2]
end function
sequence s
s = "12345"
s = sprintf("%d",{val(s)+1})

View file

@ -0,0 +1,12 @@
import gleam/int
import gleam/io
import gleam/result
pub fn main() {
"12349"
|> int.parse
|> result.unwrap(-1)
|> int.add(1)
|> int.to_string
|> io.println
}

View file

@ -0,0 +1,2 @@
$s = "12345"
$t = [string] ([int] $s + 1)

View file

@ -0,0 +1 @@
$t = [string] (1 + $s)

View file

@ -0,0 +1,21 @@
Rebol [
Title: "Increment Numerical String"
URL: http://rosettacode.org/wiki/Increment_numerical_string
]
; Note the use of unusual characters in function name. Also note that
; because REBOL collects terms from right to left, I convert the
; string argument (s) to integer first, then add that result to one.
s++: func [s][to-string 1 + to-integer s]
; Examples. Because the 'print' word actually evaluates the block
; (it's effectively a 'reduce' that gets printed space separated),
; it's possible for me to assign the test string to 'x' and have it
; printed as a side effect. At the end, 'x' is available to submit to
; the 's++' function. I 'mold' the return value of s++ to make it
; obvious that it's still a string.
print [x: "-99" "plus one equals" mold s++ x]
print [x: "42" "plus one equals" mold s++ x]
print [x: "12345" "plus one equals" mold s++ x]

View file

@ -0,0 +1,2 @@
"11" .to-integer .inc .to-string
.dump .print

View file

@ -1,9 +1,11 @@
# n is string
set n "1234"
# increments the integer rep to 1235, updates string rep to "1235"
incr n
# integer rep added to n
# o is calculated integer
set o [expr $n + 1]
set val [expr {$n + 1}]
# n is string,
# o used as string adds string representation to o