Capitalize first letter of a string for Composed words

Cool @hsendel :slight_smile: :+1:

Wait :disappointed_relieved: …Error disappears but I got the following after execution :
For Each: Unable to cast object of type ‘System.Text.RegularExpressions.Match’ to type ‘System.String’.

1 Like

Hey @hsendel

Keep the type argument of for-each as Match data type.

In the statement inside For-each just do this.

Word.Value(0).ToString.ToUpper + new String(Word.Value.Skip(1).ToArray)

Hope this helps.

Thanks
#nK

There is no this option in the list : type argument of for-each as Match data type.

tugna

1 Like

Use Browse For Types and search Match.

1 Like

tugna

1 Like

Hey @hsendel

Go to browse for types → Search Match → Choose Match which is under mscorlib → Regular expression

If you are not sure on this, just send a screenshot of that window can point it out for you.

Thanks
#nK

1 Like

The below one is not working :

tugna

1 Like

In the Assign just again use Match.Value on the To field

1 Like

Unfortunately not working too, Could you please share small example with ForEach and Assign Activities to show the same. Thanks

1 Like

Hi @hsendel ,

Could you provide us with the Screenshots of the Workflow or Better yet the Workflow Itself.

There are some missing things, which we are not able to get a Hold on, Mainly, What is the Value that is being Passed to the For Each.

We should be able to understand it better, once we have the visuals of the workflow.

1 Like

Hey @hsendel

It should be like the below in the Assign

Word.Value = Word.Value(0).ToString.ToUpper + new String(Word.Value.Skip(1).ToArray)

Hope this helps.

Thanks
#nK

1 Like

Dears,

Here’s the example.
CapitalizeFirstLetter.zip (36.2 KB)
Input ( Sentence) = The hyphen that makes the difference between follow-up and follow up is one such source of confusion.
Desired OutputOutput.xlsx (8.4 KB)

1 Like

Hey @hsendel

Please find the updated,

CapitalizeFirstLetter_v2.zip (8.5 KB)

Thanks
#nK

1 Like

@hsendel ,

You would simply Require to use a New String Variable in the Assign Activity. Then add that variable in the Add Data Row Activity.

2 Likes

Thanks both @Nithinkrishna & @supermanPunch , You’re ending with same result, I got the error, I was updating the assign value instead of ArrayValue :+1:

1 Like


Regex.Replace(“HELLo FOLLOw-UP”,"\b(.)(.*?)(\ |$)", Function (m) m.Groups(1).Value.ToUpper & m.Groups(2).Value.ToLower & m.Groups(3).Value )

1 Like

Cool @hsendel :slight_smile: :+1:

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