I am dealing with an input file containing a list of integers as a string
10
..
I have choosen to read it line by line with ReadString('\n') method
The following code
line, error := inputReader.ReadString('\n')
lineStr := string(line)
console output (length and value)
lineStr %v 4
lineStr %v 10
lineStr as a length of "4", maybe because of rune encoding.
Then I have tried several way to convert it to simple integer but with no success.
Ex1
num, _ := strconv.ParseUint(lineStr, 0, 64)
ouputs a num of 0 (should be 10)
Ex2
num, _ := strconv.Atoi(lineStr)
ouputs a num of 0 (should be 10)
Ex3
num, _ := strconv.Atoi("10")
ouputs a num of 10 (ok)
Ex4
num, _ := strconv.ParseUint("10", 0, 64)
ouputs a num of 10 (ok)
string in literal are ok but string from file do not work, what is wrong ?
thanks in advance