Function for finding a substring
function sub ( string s, int pos, int num, string result)
{
// This function takes a substring of the string s, starting
// at position pos for num characters and returns
// it in the parameter result.
int len; // length of the string
int j, k, m; // indexes
// check if the value of pos or num is out of bounds
len = length(s)
{
if (( pos <= 0 ) or ( num <= 0 ) or ( pos > len ))
No comments:
Post a Comment