Answers for "string substring last 2 characters"

0

str.substring last 2 java

String substring = str.length() > 2 ? str.substring(str.length() - 2) : str;
Posted by: Guest on September-19-2020
0

substr last 3 characters

<?php

$string = "testing string 123";

echo substr($string,-3); //this will give last 3 characters of the above string
// output "123"
echo substr($string,-5); //this will give last 5 characters of the above string
// output "g 123"
echo substr($string,5); //this will give first 5 characters of the above string
// output "testi"

?>
Posted by: Guest on September-07-2021

Code answers related to "string substring last 2 characters"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language