mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
moved SuffixHelper to StringUtils
This commit is contained in:
1 parent
019ec63f63
commit
cafa01cbf6
8 files changed
+47
-46
No files matched your search
@@ -96,3 +96,20 @@ string dev::quotedAlternativesList(vector<string> const& suggestions)
|
||||
return joinHumanReadable(quotedSuggestions, ", ", " or ");
|
||||
}
|
||||
|
||||
string dev::suffixedVariableNameList(string const& _baseName, size_t _startSuffix, size_t _endSuffix)
|
||||
{
|
||||
string result;
|
||||
if (_startSuffix < _endSuffix)
|
||||
{
|
||||
result = _baseName + to_string(_startSuffix++);
|
||||
while (_startSuffix < _endSuffix)
|
||||
result += ", " + _baseName + to_string(_startSuffix++);
|
||||
}
|
||||
else if (_endSuffix < _startSuffix)
|
||||
{
|
||||
result = _baseName + to_string(_endSuffix++);
|
||||
while (_endSuffix < _startSuffix)
|
||||
result = _baseName + to_string(_endSuffix++) + ", " + result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Reference in new issue
Block a user