Capitalize first letter of a string for Composed words

Dears,

Capitalize first letter of a string for Composed words like : Follow-up
Example : From follow-up → To Follow-up
Note : Need slight modification of : StrConv(“Word”.ToString, VbStrConv.ProperCase), which is returning : Follow-Up instead of Follow-up

2 Likes

Hey @hsendel

Just try this,

strConv(0).ToString.ToUpper + strConv.Skip(1).ToString

If required you can add ToLower in the second half, just in case

Hope this helps

Thanks
#nK

1 Like

Hi @Nithinkrishna , Where is my variable here ?

1 Like

Hey @hsendel

strConv is your string variable, which holds the string for which the first letter to be capitalised.

Thanks
#nK

1 Like

I got the following :
tugna

1 Like

Hey @hsendel

Please try this,

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

Thanks
#nK

1 Like

Returns same error message as the above

1 Like

I hope you are using Word variable which is a string ?

Thanks
#nK

In fact “Word” is one item from “For Each” Activity.

1 Like

So @hsendel, your for-each type argument should be a string ! Currently it may be set to an object that’s the reason for the late binding error.

1 Like

YES, I changed it From Object To String and It’s Working :+1: . Thanks a lot

1 Like

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