How to check if the string contains two or three characters

Hi Everyone!
I have two types of strings and I have to desing two types of follow path.
One of my string has two characters and the other one has three characters.
If my string has two chracters, I use it in excel. If my string has three characters, I use it in mail body. How to check them?

For example,

my_first_str= Ozge Ctk
my_other_str= Ozge Ctk Ozge

Hi @ozgecatak ,
U mean two and three words right.
Split the string for spaces and take the count then assign to integer variable.

For example:
int_count_first_str=my_first_str.split(" “c).Count
int_count_other_str=my_other_str.split(” "c).Count

Note:
int_count_first_str-----int32 value type
int_count_first_str-----int32 value type

According to above integer values you can proceed with your if condition operations

Thanks & Regards,
Shubham Dutta

1 Like

@ozgecatak
please count words in string
using this expression →
assign activity = my_first_str.Split(" “c).Count.ToString
assign activity=my_other_str.Split(” "c).Count.ToString
Thanks

1 Like

if
my_first_str.split(" “c).count()=2
Then…excel
elseif
my_other_str.split(” "c).count()=3
Then…Mail

1 Like

Thank you, it was helpful

Thank you, I use it and it was helpful

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