substr()

Difference between substr and substring

What is substr() method? Substr() method returns a particular number of characters starting from specified index. Syntax: startIndex – index of first character to include in the return string length – It is optional determines the number of characters to extract. Return value – A new string containing the specified part of given string. Example: …

Difference between substr and substring Read More »