From e2e153b50b889a0482ad12291dfd7ab9abe44ef1 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Wed, 22 Oct 2025 19:42:51 -0700 Subject: [PATCH] Core/Utils: add isabbrev() subroutine --- lib/PBot/Core/Utils/IsAbbrev.pm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/PBot/Core/Utils/IsAbbrev.pm diff --git a/lib/PBot/Core/Utils/IsAbbrev.pm b/lib/PBot/Core/Utils/IsAbbrev.pm new file mode 100644 index 00000000..45d68c10 --- /dev/null +++ b/lib/PBot/Core/Utils/IsAbbrev.pm @@ -0,0 +1,20 @@ +# File: IsAbbrev.pm +# +# Purpose: Check is a string is an abbreviation of another string. + +# SPDX-FileCopyrightText: 2017-2023 Pragmatic Software +# SPDX-License-Identifier: MIT + +package PBot::Core::Utils::IsAbbrev; + +use PBot::Imports; + +require Exporter; +our @ISA = qw/Exporter/; +our @EXPORT = qw/isabbrev/; + +sub isabbrev($str1, $str2) { + return (substr($str1, 0, length $str1) eq substr($str2, 0, length $str1)); +} + +1;