DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Use Batch Script to create an acronym from a variable  (Read 6,123 times)

questorfla

  • Fighting Slime all the Time
  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
Use Batch Script to create an acronym from a variable
« on: October 31, 2016, 10:34 PM »
The Variable is made up of one or more words separated by spaces.

The resulting acronym cannot be more than 8 characters in length and must contain at least the first letter from each word in the input.

If the Input was "president" the output would be "presiden" not just the letter "p". 
If the input was "president and chairperson" the output would be "pranch".

If the input was "chief cook and bottle washer" the acronym would be "ccabw" but
if the input was "cook and bottle washer"  the acronym would be coanbowa.

Is there a relatively simple way to accomplish this using a for/to loop?










ayryq

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 292
Re: Use Batch Script to create an acronym from a variable
« Reply #1 on: July 06, 2017, 09:23 PM »
Quick and dirty:

http://ericandchar.com/dc/acronym.html

ayryq

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 292
Re: Use Batch Script to create an acronym from a variable
« Reply #2 on: July 11, 2017, 01:44 PM »
Now updated to accept multiline input. Still no errorchecking or anything.
http://ericandchar.com/dc/acronym.html
Clipboard01.jpg

ayryq

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 292
Re: Use Batch Script to create an acronym from a variable
« Reply #3 on: July 31, 2017, 01:06 AM »
OK, I've got to ask... what are you looking for? What's your desired input/ouput format? And if I can be nosy, what's the purpose of these odd acronyms?

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,970
    • Gathering Badge
    • Participated in NANY Challenge Once
Re: Use Batch Script to create an acronym from a variable
« Reply #4 on: July 31, 2017, 01:28 PM »
OK, I've got to ask... what are you looking for? What's your desired input/ouput format? And if I can be nosy, what's the purpose of these odd acronyms?

I suspect that, for whatever reason, OP never got notification of replies in this thread.
Tom

Original address: https://www.donationcoder.com/forum/index.php?topic=43163.0