September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
4
Task/String-case/APL/string-case-2.apl
Normal file
4
Task/String-case/APL/string-case-2.apl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(819⌶) 'I''m using APL!'
|
||||
i'm using apl!
|
||||
1 (819⌶) 'I''m using APL!'
|
||||
I'M USING APL!
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
input$ ="alphaBETA"
|
||||
|
||||
print input$
|
||||
print upper$( input$)
|
||||
print lower$( input$)
|
||||
|
||||
end
|
||||
100 INPUT PROMPT "String: ":TX$
|
||||
110 PRINT "Lower case: ";LCASE$(TX$)
|
||||
120 PRINT "Upper case: ";UCASE$(TX$)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
s$ = "alphaBETA"
|
||||
upper$ = UCase(s$) ;uppercase
|
||||
lower$ = LCase(s$) ;lowercase
|
||||
input$ ="alphaBETA"
|
||||
|
||||
print input$
|
||||
print upper$( input$)
|
||||
print lower$( input$)
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
a$ ="alphaBETA"
|
||||
|
||||
print a$ '=> alphaBETA
|
||||
print upper$(a$) '=> ALPHABETA
|
||||
print lower$(a$) '=> alphabeta
|
||||
s$ = "alphaBETA"
|
||||
upper$ = UCase(s$) ;uppercase
|
||||
lower$ = LCase(s$) ;lowercase
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
' Define 's'
|
||||
Dim s AS String = "alphaBETA"
|
||||
a$ ="alphaBETA"
|
||||
|
||||
' Change 's' to Upper Case.
|
||||
s = s.ToUpper()
|
||||
|
||||
' Change 's' to Lower Case.
|
||||
s = s.ToLower()
|
||||
print a$ '=> alphaBETA
|
||||
print upper$(a$) '=> ALPHABETA
|
||||
print lower$(a$) '=> alphabeta
|
||||
|
|
|
|||
|
|
@ -1,18 +1,8 @@
|
|||
:"ABCDEFGHIJKLMNOPQRSTUVWXYZ"→Str9
|
||||
:"abcdefghijklmnopqrstuvwxyz"→Str0
|
||||
:Input ">",Str1
|
||||
:":"+Str1+":"→Str1
|
||||
:Prompt U
|
||||
:If U:Then
|
||||
:For(I,2,length(Str1))
|
||||
:If inString(Str0,sub(Str1,I,1)) and sub(Str1,I,1)≠":"
|
||||
:sub(Str1,1,I-1)+sub(Str9,inString(Str0,sub(Str1,I,1)),1)+sub(Str1,I+1,length(Str1)-I)→Str1
|
||||
:End
|
||||
:Else
|
||||
:For(I,2,length(Str1))
|
||||
:If inString(Str9,sub(Str1,I,1)) and sub(Str1,I,1)≠":"
|
||||
:sub(Str1,1,I-1)+sub(Str0,inString(Str9,sub(Str1,I,1)),1)+sub(Str1,I+1,length(Str1)-I)→Str1
|
||||
:End
|
||||
:End
|
||||
:sub(Str1,2,length(Str1)-2)→Str1
|
||||
:Pause Str1
|
||||
' Define 's'
|
||||
Dim s AS String = "alphaBETA"
|
||||
|
||||
' Change 's' to Upper Case.
|
||||
s = s.ToUpper()
|
||||
|
||||
' Change 's' to Lower Case.
|
||||
s = s.ToLower()
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
import system'culture.
|
||||
import system'culture;
|
||||
|
||||
program =
|
||||
[
|
||||
var s1 := "alphaBETA".
|
||||
public program()
|
||||
{
|
||||
string s1 := "alphaBETA";
|
||||
|
||||
// Alternative 1
|
||||
console writeLine(s1~caseLiteralOp lowerCase).
|
||||
console writeLine(s1~caseLiteralOp upperCase).
|
||||
console.writeLine(s1.lowerCase());
|
||||
console.writeLine(s1.upperCase());
|
||||
|
||||
// Alternative 2
|
||||
console writeLine(s1 toLower locale:currentLocale).
|
||||
console writeLine(s1 toUpper locale:currentLocale).
|
||||
console readChar.
|
||||
].
|
||||
console.writeLine(s1.toLower(currentLocale));
|
||||
console.writeLine(s1.toUpper(currentLocale));
|
||||
console.readChar()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
let () =
|
||||
let str = "alphaBETA" in
|
||||
print_endline (String.uppercase str); (* ALPHABETA *)
|
||||
print_endline (String.lowercase str); (* alphabeta *)
|
||||
print_endline (String.uppercase_ascii str); (* ALPHABETA *)
|
||||
print_endline (String.lowercase_ascii str); (* alphabeta *)
|
||||
|
||||
print_endline (String.capitalize str); (* AlphaBETA *)
|
||||
print_endline (String.capitalize_ascii str); (* AlphaBETA *)
|
||||
;;
|
||||
|
|
|
|||
18
Task/String-case/SNOBOL4/string-case-2.sno
Normal file
18
Task/String-case/SNOBOL4/string-case-2.sno
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
define('UC(STR)')
|
||||
define('LC(STR)')
|
||||
define('UCFIRST(STR)')
|
||||
define('SWAPC(STR)') :(CASES.END)
|
||||
UC uc = replace(str,&lcase,&ucase) :(RETURN)
|
||||
LC lc = replace(str,&ucase,&lcase) :(RETURN)
|
||||
UCFIRST str len(1) . ch = uc(ch) ; ucfirst = str :(RETURN)
|
||||
SWAPC swapc = replace(str, &ucase &lcase, &lcase &ucase) :(RETURN)
|
||||
CASES.END
|
||||
|
||||
* # Test and display
|
||||
str = 'alphaBETA'
|
||||
output = str
|
||||
output = lc(str)
|
||||
output = uc(str)
|
||||
output = ucfirst(str)
|
||||
output = swapc(str)
|
||||
END
|
||||
23
Task/String-case/Visual-Basic/string-case.vb
Normal file
23
Task/String-case/Visual-Basic/string-case.vb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Sub Main()
|
||||
Const TESTSTRING As String = "alphaBETA"
|
||||
Debug.Print "initial = " _
|
||||
& TESTSTRING
|
||||
Debug.Print "uppercase = " _
|
||||
& UCase(TESTSTRING)
|
||||
Debug.Print "lowercase = " _
|
||||
& LCase(TESTSTRING)
|
||||
Debug.Print "first letter capitalized = " _
|
||||
& StrConv(TESTSTRING, vbProperCase)
|
||||
Debug.Print "length (in characters) = " _
|
||||
& CStr(Len(TESTSTRING))
|
||||
Debug.Print "length (in bytes) = " _
|
||||
& CStr(LenB(TESTSTRING))
|
||||
Debug.Print "reversed = " _
|
||||
& StrReverse(TESTSTRING)
|
||||
Debug.Print "first position of letter A (case-sensitive) = " _
|
||||
& InStr(1, TESTSTRING, "A", vbBinaryCompare)
|
||||
Debug.Print "first position of letter A (case-insensitive) = " _
|
||||
& InStr(1, TESTSTRING, "A", vbTextCompare)
|
||||
Debug.Print "concatenated with '123' = " _
|
||||
& TESTSTRING & "123"
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue