[snippet] lowercase to uppsercase / uppercase to lowercase

4@ - text
[shcode=cpp]
:LowerCase_To_Uppercase
0@ = 0x40
repeat
    wait 0       
    0@ += 0x01
    if 0C2A: 2@ = strchr 4@ char 0@
    then
        0085: 1@ = 0@ // (int)
        1@ -= 0x20
        repeat
            wait 0
            0A8C: write_memory 2@ size 1 value 1@ virtual_protect 0
        until 8C2A: 2@ = strchr 4@ char 0@
    end
until 0@ == 0x7A
ret 0

:Uppercase_To_Lowercase
0@ = 0x40
repeat
    wait 0       
    0@ += 0x01
    if 0C2A: 2@ = strchr 4@ char 0@
    then
        0085: 1@ = 0@ // (int)
        1@ += 0x20
        repeat
            wait 0
            0A8C: write_memory 2@ size 1 value 1@ virtual_protect 0
        until 8C2A: 2@ = strchr 4@ char 0@
    end
until 0@ == 0x5A
ret 0
[/shcode]
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
Consider do SF free code if you want to make something like that, cuz SF already has 0c26 and 0c28 opcodes that is way performant
But better just iterate thru all chars, compare if they are in the A-Z or, for lower case, a-z range and add\sub 0x20 from it, this snippet is currently looks bad tho
Also how do you call it? It seems that you should put first 3 parameters to null and then only provide the string pointer
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
supahdupahnubah said:
Consider do SF free code if you want to make something like that, cuz SF already has 0c26 and 0c28 opcodes that is way performant
But better just iterate thru all chars, compare if they are in the A-Z or, for lower case, a-z range and add\sub 0x20 from it, this snippet is currently looks bad tho
yo respect the rules

if it works,dont touch it :D

ps probably that s the reason why i have to wait 1s~ to see the modified text
anyway for a first try and hurry mode on,it s just good
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
shanker said:
supahdupahnubah said:
Consider do SF free code if you want to make something like that, cuz SF already has 0c26 and 0c28 opcodes that is way performant
But better just iterate thru all chars, compare if they are in the A-Z or, for lower case, a-z range and add\sub 0x20 from it, this snippet is currently looks bad tho
yo respect the rules

if it works,dont touch it :D

Nah it doesn't even works, cuz first function starts iterating from A-Z range (meaning it will take [ \ ] etc characters as well)
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
supahdupahnubah said:
shanker said:
supahdupahnubah said:
Consider do SF free code if you want to make something like that, cuz SF already has 0c26 and 0c28 opcodes that is way performant
But better just iterate thru all chars, compare if they are in the A-Z or, for lower case, a-z range and add\sub 0x20 from it, this snippet is currently looks bad tho
yo respect the rules

if it works,dont touch it :D

Nah it doesn't even works, cuz first function starts iterating from A-Z range (meaning it will take [ \ ] etc characters as well)
it works for what i need ;P
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
So for a 5 char string like "hello", the first code will loop 58 times instead of 5 times, appreciate the contribution.. but like supahdupahnubah said, there should be no reason to use this over SF strupr/strlwer.

or without SF in a few lines of code

[shcode=cpp]
:lowercase
0AA5: call 0x718740 num_params 1 pop 1 0@
0AB2: 0

:uppercase
0AA5: call 0x718710 num_params 1 pop 1 0@
0AB2: 0

[/shcode]
 

shanker

Well-known member
Joined
Sep 18, 2016
Messages
291
Reaction score
16
Location
Romania
springfield said:
So for a 5 char string like "hello", the first code will loop 58 times instead of 5 times, appreciate the contribution.. but like supahdupahnubah said, there should be no reason to use this over SF strupr/strlwer.

or without SF in a few lines of code

[shcode=cpp]
:lowercase
0AA5: call 0x718740 num_params 1 pop 1 0@
0AB2: 0

:uppercase
0AA5: call 0x718710 num_params 1 pop 1 0@
0AB2: 0

[/shcode]

it works instantly :) thanks
 
Top