added substr scalar function