refactor: extract method to get the string from file