FAQ
Hello,

For a personal-use project, I'd like to formatting and scanning some data
types. Here is what I started : http://play.golang.org/p/HO73gX4S8_ try to
run this sample code and will see that p.first!=p2.first which is not what
I expected ! Indeed, string scanning will scan until there is no more
characters to scan, not what I expected at all ...
My first question: is there any other simple methods like this one ?
My second question: is this a bug or a choice from the golang dev team ?

--
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.

Search Discussions

  • RickyS at Aug 29, 2013 at 1:23 pm
    The thing you are putting into fmt.Sscanf is the string '(42;hello_world)'.
    The string part ends up with the closing parenthesis. So p2.first has the
    closing parenthesis in the string. Making p2.first not equal to p.first.

    Your Scan func is not called at all. A red herring.

    See this playground <http://play.golang.org/p/i1UB5lY_Vu>.

    --
    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.
  • Martin Schnabel at Aug 29, 2013 at 1:42 pm

    On 08/29/2013 03:23 PM, RickyS wrote:
    The thing you are putting into fmt.Sscanf is the string
    '(42;hello_world)'. The string part ends up with the closing
    parenthesis. So p2.first has the closing parenthesis in the string.
    Making p2.first not equal to p.first.

    Your Scan func is not called at all. A red herring.
    it is called but it returns an error.
      http://play.golang.org/p/oLU1Tkq-ZR

    just use spaces as separator otherwise scan does not know whether ')' is
    part of the string or the format.
      http://play.golang.org/p/huRF9uFCwc

    --
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedAug 29, '13 at 1:13a
activeAug 29, '13 at 1:42p
posts3
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase