Shell: Use starts_with() in expand_parameters

This reads a little nicer, and makes us care less about an empty String
This commit is contained in:
Shannon Booth 2020-03-22 11:32:52 +13:00 committed by Andreas Kling
parent d806dfe801
commit 1ef3d4af69
Notes: sideshowbarker 2024-07-19 08:11:35 +09:00

View file

@ -700,8 +700,7 @@ static Vector<String> expand_globs(const StringView& path, const StringView& bas
static Vector<String> expand_parameters(const StringView& param)
{
bool is_variable = param.length() > 1 && param[0] == '$';
if (!is_variable)
if (!param.starts_with('$'))
return { param };
String variable_name = String(param.substring_view(1, param.length() - 1));