Skip to content
Snippets Groups Projects
  • Per Hedbor's avatar
    99255182
    Added min- and max- range-indicators to strings. · 99255182
    Per Hedbor authored
    Also added flags indicating if a string is lowercase or uppercase.
    
    The min/max is only calculated on demand to avoid any slowdowns.
    
    This makes upper_case/lower_case(X), where X is an already lowercased
    string very fast ('search' also utilize the ranges when available, so
    search(string,"\0") is very fast if there are no null characters in
    the string).
    
    It also speeds up the %s format for get_all_args (at least the second
    time a certain string is used) since the function checking for null
    characters can now use the fields.
    
    Currently most string operations simply reset the string to unchecked,
    as an optimization they could copy the ranges/flag as appropriate.
    
    The + operator already does keep track of the flags and ranges.
    
    For wide-strings the min/max value is somewhat less correct, since
    it's saved in a single byte. But '0' still works (you get string(0..X)
    for strings with 0, and string(1..X) for strings without 0 but with
    any other character from the first 255).
    99255182
    History
    Added min- and max- range-indicators to strings.
    Per Hedbor authored
    Also added flags indicating if a string is lowercase or uppercase.
    
    The min/max is only calculated on demand to avoid any slowdowns.
    
    This makes upper_case/lower_case(X), where X is an already lowercased
    string very fast ('search' also utilize the ranges when available, so
    search(string,"\0") is very fast if there are no null characters in
    the string).
    
    It also speeds up the %s format for get_all_args (at least the second
    time a certain string is used) since the function checking for null
    characters can now use the fields.
    
    Currently most string operations simply reset the string to unchecked,
    as an optimization they could copy the ranges/flag as appropriate.
    
    The + operator already does keep track of the flags and ranges.
    
    For wide-strings the min/max value is somewhat less correct, since
    it's saved in a single byte. But '0' still works (you get string(0..X)
    for strings with 0, and string(1..X) for strings without 0 but with
    any other character from the first 255).