Develop a function in Python that takes a string and an integer as input and returns the string with the length of the integer.
'Hello World', 5
def truncateString(inputString, length):
    return inputString[:length]

print(truncateString('Hello World', 5))