implemented custom string length function
transitioning from c to objc