Select first element of a string

How do I extract the first letter in a string?
Suppose I have a string stored in one variable example x=“test”. I need to get the letter “t” into another variable y.
How do I do it?

@Akshay_Patti x = x.substring(0,1).Tostring

2 Likes

@Akshay_Patti You can also use .Chars(0), that way it directly gets converted to a Char type variable.

2 Likes

Thank you @indra

Thank you @evangemert

How to get second?

variable.ToString.substring(1,1) - first 1 reffers to startindex, second refers to the length.

1 Like

I want to delete the post please delete my post