Extract first letter of every word of a given string

I want to extract first letter of every word of a given string sometimes it contains 5 words and sometimes 2. I am able to scrap first letter but I know how many words in string, how it possible where I don’t know how many words in string.
Any suggestion?

1 Like

Can you give more details about it i dont get it.

If you want to get the first letter of the string just use the left functions and pass the index.

See this link for your reference.

cheers :smiley:

Happy learning :smiley:

You can use a matches activity with this pattern: “(^\w| \w)”


After that, loop the result and get each items value.
Something like this:

If you want to exstract First letter of string then use
WordVariable.Substring(0,1)
For length of string use
WordVariable.Length

1 Like

Hello @pattyricarte
Suppose string is “My First Name” so its scrap “MFN” only. I am able to scrap first letter where I know how many words in string but I want to scrap first letter of string where I don’t know how many words in string.

1 Like

hmmm if this is the format you just need to split the string and make it an array using the delimited of the space.then you can get the first letter of the array per index. hope it make sense. @kalpitmantri

cheers :smiley:

Happy learning :smiley:

Hi @kalpitmantri

Try the below code
string.Join(string.Empty,"My First Name".Split(" "c).Select(Function(l) l.Substring(0,1)))

1 Like

Thanks @aanandsanraj its working.

Most welcome :slightly_smiling_face: @kalpitmantri

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.