第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何從字符串中刪除二進(jìn)制內(nèi)容?

如何從字符串中刪除二進(jìn)制內(nèi)容?

Go
守候你守候我 2021-11-22 15:03:58
我試圖使用 golang 從 mp3 文件中讀取 ID3 標(biāo)簽。我得到了結(jié)果。但正如我的數(shù)據(jù)庫(kù)查看器所建議的那樣,它們也包含一些二進(jìn)制內(nèi)容。有什么辦法可以在 golang 中刪除該內(nèi)容?
查看完整描述

1 回答

?
拉風(fēng)的咖菲貓

TA貢獻(xiàn)1995條經(jīng)驗(yàn) 獲得超2個(gè)贊

這是id3-go 中的當(dāng)前問(wèn)題:PR 8針對(duì) id3v1 修復(fù)了它


但這對(duì)于 id3v2 來(lái)說(shuō)還不夠,如本次提交所示,它確實(shí)必須修剪那些空字符。請(qǐng)參閱cutset := string(rune(0)), 和 of的使用,TrimRight(s string, cutset string)例如strings.TrimRight(fd.Title(), cutset):


fd, err := id3.Open(path)

if err != nil {

    item.Title = f.Name()

} else {

    defer fd.Close()

    cutset := string(rune(0))

    title := strings.TrimRight(fd.Title(), cutset)

    author := strings.TrimRight(fd.Artist(), cutset)

    if len(title) > 0 {

        item.Title = title

    } else {

        item.Title = author

        if len(author) > 0 {

            item.Title += " - "

        }

        item.Title += strings.TrimRight(f.Name(), cutset)

    }

    item.Subtitle = author

    tcon := fd.Frame("TCON")

    if tcon != nil {

        item.Categories = append(item.Categories, Text{Value: strings.TrimRight(tcon.String(), cutset)})

    }

    item.PubDate = strings.TrimRight(formatYear(fd.Year()), cutset)


查看完整回答
反對(duì) 回復(fù) 2021-11-22
  • 1 回答
  • 0 關(guān)注
  • 135 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)