We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 088bcb8 commit 8830b7bCopy full SHA for 8830b7b
lesson_06/expression/src/abbre-stretch-wayvar.ts
@@ -0,0 +1,20 @@
1
+function isValidAlphaAbbreviation(word: string, abbr: string): boolean {
2
+ if (word.length < 1 || word.length > 25 || abbr.length < 1 || abbr.length > 15) {
3
+ return false;
4
+ }
5
+
6
+ const hasNumbers = (str: string): boolean => /\d/.test(str);
7
+ if (hasNumbers(word) || hasNumbers(abbr)) {
8
9
10
11
+ let wordIndex = 0;
12
+ let abbrIndex = 0;
13
14
+ const letterToNumber = (char: string): number => {
15
+ return char.charCodeAt(0) - 'a'.charCodeAt(0) + 1;
16
+ };
17
18
19
+}
20
0 commit comments