Ignore:
Timestamp:
09/09/23 15:20:04 (17 months ago)
Author:
Maciej Komosinski
Message:

Added ends_with() for std::string

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/util-string.cpp

    r1130 r1276  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2023  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    108108}
    109109
     110bool ends_with(std::string_view str, std::string_view suffix)
     111{
     112        return str.size() >= suffix.size() && 0 == str.compare(str.size() - suffix.size(), suffix.size(), suffix);
     113}
     114
     115
    110116char* strmove(char *a, char *b) //strcpy that works well for overlapping strings ("Source and destination overlap")
    111117{
Note: See TracChangeset for help on using the changeset viewer.