can you relove this problem?I have encountered this problem.
On Tuesday, November 23, 2010 8:55:32 PM UTC+8, chris dollin wrote:
On 23 November 2010 12:39, Andreas Otto <aott...@t-online.de <javascript:>>
wrote:
the type you want to test for -- be it an interface type or a concrete
type -- then
aT, isT := X.(T)
will set isT to true iff X has underlying type T and aT to the
corresponding
T value (the zero value if isT = false).
Are you really sure you want to be doing this test? (You can test an
interface{} for equality against a string anyway ..)
Chris
--
Chris "allusive" Dollin
--On 23 November 2010 12:39, Andreas Otto <aott...@t-online.de <javascript:>>
wrote:
my problem is that the only way to convert an "interface{}",
using a "unknown" type, into an "string" is (as I know)
fmt.Sprintf("%s", ifc)
Is this right, or can I test for an "string" like interface?
You can use a type test. If X is your interface{} variable and T isusing a "unknown" type, into an "string" is (as I know)
fmt.Sprintf("%s", ifc)
Is this right, or can I test for an "string" like interface?
the type you want to test for -- be it an interface type or a concrete
type -- then
aT, isT := X.(T)
will set isT to true iff X has underlying type T and aT to the
corresponding
T value (the zero value if isT = false).
what is the standard in GO if something support a serialization into a
"string" object
fmt.Stringer looks like the plausible candidate."string" object
Are you really sure you want to be doing this test? (You can test an
interface{} for equality against a string anyway ..)
Chris
--
Chris "allusive" Dollin
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.