Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -0,0 +1,15 @@
UCASE CSECT
USING UCASE,R15
MVC UC,PG
MVC LC,PG
OC UC,=16C' ' or X'40' uppercase
NC LC,=16X'BF' and X'BF' lowercase
XPRNT PG,L'PG print original
XPRNT UC,L'UC print uc
XPRNT LC,L'LC print lc
BR R14
PG DC CL9'alphaBETA'
UC DS CL(L'PG)
LC DS CL(L'PG)
YREGS
END UCASE

View file

@ -0,0 +1,31 @@
UCASE CSECT
USING UCASE,R15
MVC UC,PG
MVC LC,PG
TR UC,TABLEU TR uppercase
TR LC,TABLEL TR lowercase
XPRNT PG,L'PG print original
XPRNT UC,L'UC print uc
XPRNT LC,L'LC print lc
BR R14
PG DC CL9'alphaBETA'
UC DS CL(L'PG)
LC DS CL(L'PG)
TABLEU DC 256AL1(*-TABLEU)
ORG TABLEU+C'a'
DC C'ABCDEFGHI'
ORG TABLEU+C'j'
DC C'JKLMNOPQR'
ORG TABLEU+C's'
DC C'STUVWXYZ'
ORG
TABLEL DC 256AL1(*-TABLEL)
ORG TABLEL+C'A'
DC C'abcdefghi'
ORG TABLEL+C'J'
DC C'jklmnopqr'
ORG TABLEL+C'S'
DC C'stuvwxyz'
ORG
YREGS
END UCASE

View file

@ -0,0 +1,42 @@
begin
% algol W doesn't have standard case conversion routines, this is one way %
% such facilities could be provided %
% converts text to upper case %
% assumes the letters are contiguous in the character set (as in ASCII) %
% would not work in EBCDIC (as the original algol W implementations used) %
procedure upCase( string(256) value result text ) ;
for i := 0 until 255 do begin
string(1) c;
c := text( i // 1 );
if c >= "a" and c <= "z"
then begin
text( i // 1 ) := code( decode( "A" )
+ ( decode( c ) - decode( "a" ) )
)
end
end upCase ;
% converts text to lower case %
% assumes the letters are contiguous in the character set (as in ASCII) %
% would not work in EBCDIC (as the original algol W implementations used) %
procedure dnCase( string(256) value result text ) ;
for i := 0 until 255 do begin
string(1) c;
c := text( i // 1 );
if c >= "A" and c <= "Z"
then begin
text( i // 1 ) := code( decode( "a" )
+ ( decode( c ) - decode( "A" ) )
)
end
end dnCase ;
string(256) text;
text := "alphaBETA";
upCase( text );
write( text( 0 // 40 ) );
dnCase( text );
write( text( 0 // 40 ) );
end.

View file

@ -0,0 +1,15 @@
#import system.
#import system'culture.
#symbol program =
[
#var s1 := "alphaBETA".
// Alternative 1
console writeLine:(s1::caseLiteralOp lowerCase).
console writeLine:(s1::caseLiteralOp upperCase).
// Alternative 2
console writeLine:(s1 toLower &locale:currentLocale).
console writeLine:(s1 toUpper &locale:currentLocale).
].

View file

@ -1,4 +1,4 @@
NSLog(@"%@", [@"alphaBETA" uppercaseString]);
NSLog(@"%@", [@"alphaBETA" lowercaseString]);
NSLog(@"%@", @"alphaBETA".uppercaseString);
NSLog(@"%@", @"alphaBETA".lowercaseString);
NSLog(@"%@", [@"foO BAr" capitalizedString]); // "Foo Bar"
NSLog(@"%@", @"foO BAr".capitalizedString); // "Foo Bar"

View file

@ -0,0 +1,4 @@
fn main() {
println!("{}", "jalapeño".to_uppercase()); // JALAPEÑO
println!("{}", "JALAPEÑO".to_lowercase()); // jalapeño
}