Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
35
Task/String-case/Amazing-Hopper/string-case.hopper
Normal file
35
Task/String-case/Amazing-Hopper/string-case.hopper
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#include <hopper.h>
|
||||
|
||||
#proto swapcase(_X_)
|
||||
|
||||
main:
|
||||
|
||||
// literal:
|
||||
String to process = "alphaBETA", {"String to process: ",String to process}println
|
||||
{"UPPER: ",String to process} upper,println
|
||||
{"LOWER: ",String to process} lower,println
|
||||
{"SWAP CASE: "}
|
||||
s="", let( s := _swap case(String to process)),{s}println
|
||||
// arrays:
|
||||
vArray=0, {5,5} new array(vArray), vArray=String to process
|
||||
{"ARRAY UPPER: \n",vArray} upper,println
|
||||
{"ARRAY LOWER: \n",vArray} lower,println
|
||||
[1:2:end,1:2:end]get(vArray),upper, put(vArray)
|
||||
[2:2:end,2:2:end]get(vArray),lower, put(vArray)
|
||||
{"INTERVAL ARRAY UPPER/LOWER: \n",vArray},println
|
||||
|
||||
exit(0)
|
||||
|
||||
.locals
|
||||
swapcase(_X_)
|
||||
nLen=0, {_X_}len,mov(nLen)
|
||||
__SWAPCASE__:
|
||||
if( [nLen:nLen]get(_X_),{"upper"}!typechar? )
|
||||
lower
|
||||
else
|
||||
upper
|
||||
end if
|
||||
put(_X_)
|
||||
--nLen,{nLen}jnz(__SWAPCASE__)
|
||||
{_X_} // put processed string into the stack...
|
||||
back
|
||||
Loading…
Add table
Add a link
Reference in a new issue