Menu

Weekly Challenge: Group Tag

DEV Community: perl·Simon Green·7 months ago
#LQHsCDpI
Reading 0:00
15s threshold

Weekly Challenge 369

Each week Mohammad S. Anwar sends out The Weekly Challenge , a chance for all of us to come up with solutions to two weekly tasks. My solutions are written in Python first, and then converted to Perl. Unless otherwise stated, Copilot (and other AI tools) have NOT been used to generate the solution. It's a great way for us all to practice some coding.

Challenge , My solutions

Task 1: Valid Tag

Submitted by: Mohammad Sajid Anwar

You are given a given a string caption for a video.

Write a script to generate tag for the given string caption in three steps as mentioned below:

Format as camelCase Starting with a lower-case letter and capitalising the first letter of each subsequent word: Merge all words in the caption into a single string starting with a #.

Sanitise the String: Strip out all characters that are not English letters (a-z or A-Z).

Enforce Length: If the resulting string exceeds 100 characters, truncate it so it is exactly 100 characters long.

My solution

The last…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.