Get the last character in a string variable

How can i get the last caracter in a string variable ?

value.Substring(value.Length-1)

1 Like

Example:

1 Like

lastchar
Hi @Soudios ,
StringValue.Substring(StringValue.Length-1)
Here Stringvalue is our variable

Using StringBuilder;
declare StringBuilder instance variable: StringBuilder value= new StringBuilder();
String LastChar = value.substring(value.length()-1);

Hi @Soudios

Use this: StringValue.Substring(StringValue.Length-1)

This will give you only last character of string.

Hi

sampleString.Substring(sampleString.Length-1)
This will you give last character of the string

Regards,
Dhanush

Hi @Soudios

use this solution :

YourText.Substring(YourText.Length-1)