[Scummvm-git-logs] scummvm master -> b1d20e4b569050202d98eef777528981b5e72194

sev- sev at scummvm.org
Sat Feb 15 21:07:26 UTC 2020


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b1d20e4b56 COMMON: Add find() method for character to U32String


Commit: b1d20e4b569050202d98eef777528981b5e72194
    https://github.com/scummvm/scummvm/commit/b1d20e4b569050202d98eef777528981b5e72194
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2020-02-15T22:07:22+01:00

Commit Message:
COMMON: Add find() method for character to U32String

This is like strchr but for uint32 based strings

Changed paths:
    common/ustr.cpp
    common/ustr.h


diff --git a/common/ustr.cpp b/common/ustr.cpp
index 5d6df03..d68b66d 100644
--- a/common/ustr.cpp
+++ b/common/ustr.cpp
@@ -282,6 +282,16 @@ void U32String::toUppercase() {
 	}
 }
 
+uint32 U32String::find(value_type x, uint32 pos) const {
+	for (uint32 i = pos; i < _size; ++i) {
+		if (_str[i] == x) {
+			return i;
+		}
+	}
+
+	return npos;
+}
+
 uint32 U32String::find(const U32String &str, uint32 pos) const {
 	if (pos >= _size) {
 		return npos;
diff --git a/common/ustr.h b/common/ustr.h
index affa167..46d5753 100644
--- a/common/ustr.h
+++ b/common/ustr.h
@@ -188,6 +188,7 @@ public:
 	 */
 	void toUppercase();
 
+	uint32 find(value_type x, uint32 pos = 0) const;
 	uint32 find(const U32String &str, uint32 pos = 0) const;
 
 	typedef value_type *        iterator;




More information about the Scummvm-git-logs mailing list