|
171 | 171 | "tags": ["string", "manipulation", "word count", "count"],
|
172 | 172 | "author": "axorax"
|
173 | 173 | },
|
174 | | - { |
175 | | - "title": "Trim a String to a Specified Length", |
176 | | - "description": "Trims a string to a specified length and appends '...' if it exceeds that length.", |
177 | | - "code": [ |
178 | | - "function trimString(str, maxLength) {", |
179 | | - " return str.length > maxLength ? str.slice(0, maxLength) + '...' : str;", |
180 | | - "}", |
181 | | - "", |
182 | | - "// Example usage:", |
183 | | - "console.log(trimString('Hello, world!', 5)); // Output: 'Hello...'" |
184 | | - ], |
185 | | - "tags": ["string", "javascript", "trim"], |
186 | | - "author": "axorax" |
187 | | - }, |
188 | 174 | {
|
189 | 175 | "title": "Remove All Whitespace",
|
190 | 176 | "description": "Removes all whitespace from a string.",
|
|
0 commit comments