mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:47:45 +00:00
LexicalPath: Simplify a loop
No behavior change.
This commit is contained in:
parent
c8b496162d
commit
59596ff816
1 changed files with 2 additions and 6 deletions
|
@ -89,12 +89,8 @@ void LexicalPath::canonicalize()
|
||||||
m_dirname = dirname_builder.to_string();
|
m_dirname = dirname_builder.to_string();
|
||||||
|
|
||||||
m_basename = canonical_parts.last();
|
m_basename = canonical_parts.last();
|
||||||
String dot { "." };
|
|
||||||
Optional<size_t> last_dot, end = m_basename.index_of(dot);
|
Optional<size_t> last_dot = StringView(m_basename).find_last_of('.');
|
||||||
while (end.has_value()) {
|
|
||||||
last_dot = end;
|
|
||||||
end = m_basename.index_of(dot, end.value() + 1);
|
|
||||||
}
|
|
||||||
if (last_dot.has_value()) {
|
if (last_dot.has_value()) {
|
||||||
m_title = m_basename.substring(0, last_dot.value());
|
m_title = m_basename.substring(0, last_dot.value());
|
||||||
m_extension = m_basename.substring(last_dot.value() + 1, m_basename.length() - last_dot.value() - 1);
|
m_extension = m_basename.substring(last_dot.value() + 1, m_basename.length() - last_dot.value() - 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue