func (c *CardIDs) String() string {
	var sb strings.Builder
	for _, id := range c.IDs {
		count := c.Count(id)
		sb.WriteString(strconv.Itoa(count))
		sb.WriteString("x ")
		sb.WriteString(strconv.FormatInt(id, 10))
		sb.WriteString("\n")
	}
	return sb.String()
}
String representation of a CardIDs struct.
package ygo
import (
	"bufio"
	"fmt"
	"io"
	"net/http"
	"regexp"
	"strconv"
	"strings"
	"github.com/antchfx/htmlquery"
	"github.com/antchfx/xpath"
	"golang.org/x/net/html"
	"github.com/jeandeaual/tts-deckconverter/log"
	"github.com/jeandeaual/tts-deckconverter/plugins"
	"github.com/jeandeaual/tts-deckconverter/plugins/ygo/api"
)
const (
	defaultBackURL           = "http://cloud-3.steamusercontent.com/ugc/998016607072069584/863E293843E7DB475380CA7D024416AA684C6167/"
	tcgBackURL               = "http://cloud-3.steamusercontent.com/ugc/998016607077817519/C47C4D4C243E14917FBA0CF8A396E56662AB3E0A/"
	ocgBackURL               = "http://cloud-3.steamusercontent.com/ugc/998016607077818666/9AADE856EC9E2AE6BF82557A2FA257E5F6967EC9/"
	animeBackURL             = "http://cloud-3.steamusercontent.com/ugc/998016607072063005/EA4E58868A0DB8A94A1243E61434089CF319F37D/"
	ygoproDeckFileXPath      = ` 
	ygoproDeckTitleXPath     = ` 
	yugiohTopDecksFileXPath  = ` 
	yugiohTopDecksTitleXPath = `/html/body/div[3]/div[2]/div[1]/div[1]/div/h3/b`
)
var cardLineRegexps = []*regexp.Regexp{
	regexp.MustCompile(`^(?P<Count>[1-4])[xX]?\s+(?P<Name>.+)$`),
	regexp.MustCompile(`^(?P<Name>.+)\s+[xX]?(?P<Count>[1-4])$`),
}
var mainRegex = regexp.MustCompile(`^Main:?$`)
var extraRegex = regexp.MustCompile(`^Extra:?$`)
var sideRegex = regexp.MustCompile(`^Side:?$`)
type DeckType int
const (
	None DeckType = iota
	Main
	Extra
	Side
)
type CardIDs struct {
	IDs []int64
	Counts map[int64]int
}
func NewCardIDs() *CardIDs {
	counts := make(map[int64]int)
	return &CardIDs{Counts: counts}
}
func (c *CardIDs) Insert(id int64) {
	c.InsertCount(id, 1)
}
func (c *CardIDs) InsertCount(id int64, count int) {
	_, found := c.Counts[id]
	if !found {
		c.IDs = append(c.IDs, id)
		c.Counts[id] = count
	} else {
		c.Counts[id] = c.Counts[id] + count
	}
}
func (c *CardIDs) Count(id int64) int {
	return c.Counts[id]
}