CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
StringUtils.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "String.hpp"
11
12namespace CeresEngine {
13
15 const StringView::size_type offset = string.find(delimiter);
16 if(offset == StringView::npos) {
17 return StringView();
18 }
19 return string.substr(0, offset + delimiter.length());
20 }
21
23 const StringView::size_type offset = string.rfind(delimiter);
24 if(offset == StringView::npos) {
25 return StringView();
26 }
27 return string.substr(offset);
28 }
29
30} // namespace CeresEngine
Definition Application.hpp:19
StringView firstPartOfString(const StringView string, const StringView delimiter)
Definition StringUtils.hpp:14
BasicStringView< char > StringView
Narrow string view used for handling narrow encoded text in UTF-8.
Definition String.hpp:190
StringView lastPartOfString(const StringView string, const StringView delimiter)
Definition StringUtils.hpp:22
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25