LuNaRiZe
i've just put a function together strLunzarize, i will add it to the upcoming release, the function:
//
//Copyright (c) CodeZiron.com
//
function strLunarize(char* str) {
push esi
mov esi, str
mov edx, str
@chkupper:
lodsb
al = or;
je @exit;
cmp al, 'A'
jb @chklower;
cmp al, 'Z'
ja @chklower;
add al, 0x20;
mov [esi-1], al
@chklower:
lodsb
al = or;
je @exit;
cmp al, 'a'
jb @chkupper;
cmp al, 'z'
ja @chkupper;
sub al, 0x20;
mov [esi-1], al
jmp @chkupper;
@exit:
xchg eax, edx
pop esi
ret
}
the usage is very simple
//declare our string storage; actually we only need 42, but i will keep it aligned on 4 bytes
char* mystr = new 48;
//copy a string into our buffer
strlcpy(mystr, 'Ziron Is MY FAVorite programming LANGUAGE', 41);
//call the RTL function
mystr = strLunarize(mystr);
//output the string
WriteLn(mystr);
//deallocate the storage
delete mystr;
this of course will output the following:
zIrOn iS My fAvOrItE PrOgRaMmInG LaNgUaGe
enjoy.