8BitWarrior

[GML] string_lower_ascii()

Apr 13th, 2020
393
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// string_lower_ascii(string, offset)
  2. /// @description Faster implementation for lowering short ASCII strings (e.g. "John Smith" -> "john smith")
  3. /// @param string
  4. /// @param offset   default = 0
  5. /// return: string
  6.  
  7. repeat(string_length(argument0)-argument1)
  8. {
  9.     if (string_byte_at(argument0, ++argument1) <= 90 && string_byte_at(argument0, argument1) >= 65)
  10.     {
  11.         argument0 = string_set_byte_at(argument0, argument1, 32+string_byte_at(argument0, argument1));
  12.     }
  13. }
  14.  
  15. return argument0;
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×