How to convert utf8 string to decimal?

E.g.:
Input: “abc”
Output: “979899”

1 Like

Have you checked out the Encoding libraries?
I got a similar result using Encoding/Binary last week.

https://golang.org/pkg/encoding/binary/

1 Like

What base is that?

1 Like

It’s ASCII codes for a (97), b (98) and c (99)

1 Like

I’d never came to this conclusion on my own… But if the result shall be a string I consider the implementation pretty trivial (loop over string, convert rune to int, append to accumulator) so I won’t solve it here but rather ask the op what code he already has and what it does and what he did expect instead.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.