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?
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
Happy learning
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
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.
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
Happy learning
Try the below code
string.Join(string.Empty,"My First Name".Split(" "c).Select(Function(l) l.Substring(0,1)))
Thanks @aanandsanraj its working.
Most welcome @kalpitmantri
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.