Skip to main content
added 121 characters in body
Source Link
Santanu Boral
  • 36.2k
  • 8
  • 45
  • 72

Use substring method of String classString Class.

String str = 'a1h5D0000055ZLfETC-547561-12';
String resultantStr = str.substring(str.length()-2);

It will return 12 i.e. last 2 characters from str.

Use substring method of String class.

String str = 'a1h5D0000055ZLfETC-547561-12';
String resultantStr = str.substring(str.length()-2);

It will return 12 i.e. last 2 characters from str.

Use substring method of String Class.

String str = 'a1h5D0000055ZLfETC-547561-12';
String resultantStr = str.substring(str.length()-2);

It will return 12 i.e. last 2 characters from str.

Source Link
Santanu Boral
  • 36.2k
  • 8
  • 45
  • 72

Use substring method of String class.

String str = 'a1h5D0000055ZLfETC-547561-12';
String resultantStr = str.substring(str.length()-2);

It will return 12 i.e. last 2 characters from str.