string function implementation