From c5c3be9e5d74cda08df2c36412e0a652f1433d4f Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 20 May 2024 15:27:42 -0400 Subject: Deprecate Text.slice() --- builtins/text.c | 15 --------------- builtins/text.h | 1 - 2 files changed, 16 deletions(-) (limited to 'builtins') diff --git a/builtins/text.c b/builtins/text.c index a3161926..e8c476a3 100644 --- a/builtins/text.c +++ b/builtins/text.c @@ -128,21 +128,6 @@ public uint32_t Text$hash(const CORD *cord) return hash; } -public CORD Text$slice(CORD text, int64_t first, int64_t length) -{ - if (length == 0) return CORD_EMPTY; - int64_t len = CORD_len(text); - - if (length < -len) return CORD_EMPTY; - - if (first <= 0) first = len + first + 1; - if (first < 1) first = 1; - else if (first > len + 1) first = len + 1; - - if (length < 0) length = len + length; - return CORD_substr(text, first - 1, length); -} - public CORD Text$upper(CORD str) { if (!str) return str; diff --git a/builtins/text.h b/builtins/text.h index e97c4010..d738125f 100644 --- a/builtins/text.h +++ b/builtins/text.h @@ -22,7 +22,6 @@ CORD Text$quoted(CORD str, bool colorize); int Text$compare(const CORD *x, const CORD *y); bool Text$equal(const CORD *x, const CORD *y); uint32_t Text$hash(const CORD *cord); -CORD Text$slice(CORD text, int64_t first, int64_t length); CORD Text$upper(CORD str); CORD Text$lower(CORD str); CORD Text$title(CORD str); -- cgit v1.2.3