Quantcast

Jump to content

» «
Photo

Upper to Lower case conversion

4 replies to this topic
Lev_Landau
  • Lev_Landau

    Player Hater

  • Members
  • Joined: 11 Aug 2013

#1

Posted 16 December 2013 - 02:36 AM Edited by Lev_Landau, 16 December 2013 - 02:42 AM.

My variable stores a string:

[email protected] = "UpperToLower"

I need a function, that does the upper case to lower case conversion trick, something like:

0AB1: call_scm_func @CONVERT 4 [email protected] [email protected] [email protected] [email protected] return [email protected]

Now variable [email protected] stores this string:

[email protected] == "uppertolower"

Any help is really appreciated, Thank You


fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • Poland
  • Best Conversion 2016 [GTA: Underground] [Contribution]
    Contribution Award [Mods]

#2

Posted 16 December 2013 - 06:14 AM

:LowerString
{
 Description: 
    Returns string with all alphabetic characters converted to lowercase.
 Type: SET  
 
 
 Parameters:
   Passed:
     [email protected], [email protected], [email protected], [email protected] ([email protected]) - long string to lower
     [email protected] - type of variable to return (2 - short var, 4 - long var) 
 
 Example:
  0AB1: call_scm_func @LowerString 5 string [email protected] [email protected] 0 0 return_type 2 [email protected] [email protected]       
}
0A9F: [email protected] = current_thread_pointer
[email protected] += 60    // [email protected] adress  


:LowerStringLoop
0A8D: [email protected] = read_memory [email protected] size 1 virtual_protect 0
   
if
[email protected] <> 0x00
else_jump @LowerStringReturn

    if and
    [email protected] >= 65
    [email protected] <= 90
    then
    [email protected] += 32
    0A8C: write_memory [email protected] size 1 value [email protected] virtual_protect 0
    end
    
[email protected] += 1       
jump @LowerStringLoop

:LowerStringReturn

    if
    [email protected] == 4
    then
    0AB2: ret 4 [email protected] [email protected] [email protected] [email protected]
    else
    0AB2: ret 2 [email protected] [email protected] 
    end

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown
  • Contribution Award [Mods]

#3

Posted 16 December 2013 - 11:58 AM Edited by Wesser, 16 December 2013 - 12:18 PM.

Simple as hell (untested):SCM functions look ugly here.
  • DK22Pac likes this

DK22Pac
  • DK22Pac

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine
  • Best WIP Mod 2014 [Grand Theft Auto 3D Contribution]
    Contribution Award [Mods]

#4

Posted 16 December 2013 - 12:03 PM Edited by _DK, 16 December 2013 - 12:03 PM.

Or even using directly [email protected] as paramter for 0AA5 with CLEO4 :)
0AA5: call _convertStringToLowcase num_params 1 pop 1 pszString [email protected]

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown
  • Contribution Award [Mods]

#5

Posted 16 December 2013 - 12:31 PM

Heh, I'm not quite familiar with CLEO4. :p




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users