why?. For eg: can I do like this [...]rune("ABC")
-Rjesh
On Friday, December 10, 2010 4:50:46 AM UTC+5:30, Jim Teeuwen wrote:
Incidentally, this also works for fetching unicode runes from a string
and in reverse:
runes := []int("foo")
str := string(runes)
--Incidentally, this also works for fetching unicode runes from a string
and in reverse:
runes := []int("foo")
str := string(runes)
On Dec 9, 10:57 pm, Andrew Gerrand wrote:
To expand a little: this is how type conversions work more generally in Go.
To convert variable v to type T, you would do:
T(v)
So, to do the reverse of Rob's example, you can convert the []byte b
to a string like so:
string(b)
Andrew
On 9 December 2010 23:59, Rob 'Commander' Pike wrote:
[]byte("string")
-rob
To expand a little: this is how type conversions work more generally in Go.
To convert variable v to type T, you would do:
T(v)
So, to do the reverse of Rob's example, you can convert the []byte b
to a string like so:
string(b)
Andrew
On 9 December 2010 23:59, Rob 'Commander' Pike wrote:
On Thu, Dec 9, 2010 at 7:57 AM, Thomas Kaufmann wrote:
Hi,
Hi,
how can I convert a string in a byte array?
By converting a string [to] a byte array: []byte("string")
-rob