Answers for "substring last 4 characters"

C#
11

how to select last 2 elements in a string python

>>>mystr = "abcdefghijkl"
>>>mystr[-4:]
'ijkl'

>>>mystr[:-4] #to select all but last 4 characters
'abcdefgh'
Posted by: Guest on July-09-2020
0

last two characters of string c#

string str = "Hello World";
string substr = str.Substring(str.Length - 2);
Posted by: Guest on July-20-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 "substring last 4 characters"

C# Answers by Framework

Browse Popular Code Answers by Language