refac: input commands

This commit is contained in:
Timothy J. Baek committed 2024-08-23 14:31:39 +02:00
1 parent 64c0157271
commit 591962d906
7 files changed
+304 -331

No files matched your search

+14
View File
@@ -288,6 +288,20 @@ export const findWordIndices = (text) => {
return matches;
};
export const removeLastWordFromString = (inputString, wordString) => {
// Split the string into an array of words
const words = inputString.split(' ');
if (words.at(-1) === wordString) {
words.pop();
}
// Join the remaining words back into a string
const resultString = words.join(' ');
return resultString;
};
export const removeFirstHashWord = (inputString) => {
// Split the string into an array of words
const words = inputString.split(' ');