mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:27:43 +00:00
Everywhere: Use to_number<T> instead of to_{int,uint,float,double}
In a bunch of cases, this actually ends up simplifying the code as to_number will handle something such as: ``` Optional<I> opt; if constexpr (IsSigned<I>) opt = view.to_int<I>(); else opt = view.to_uint<I>(); ``` For us. The main goal here however is to have a single generic number conversion API between all of the String classes.
This commit is contained in:
parent
a4ecc65398
commit
e2e7c4d574
155 changed files with 397 additions and 412 deletions
|
@ -358,7 +358,7 @@ ByteString deduplicate_destination_file_name(ByteString const& destination)
|
|||
auto last_hyphen_index = title_without_counter.find_last('-');
|
||||
if (last_hyphen_index.has_value()) {
|
||||
auto counter_string = title_without_counter.substring_view(*last_hyphen_index + 1);
|
||||
auto last_counter = counter_string.to_uint();
|
||||
auto last_counter = counter_string.to_number<unsigned>();
|
||||
if (last_counter.has_value()) {
|
||||
next_counter = *last_counter + 1;
|
||||
title_without_counter = title_without_counter.substring_view(0, *last_hyphen_index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue