• 10266阅读
  • 4回复

[提问]如何从一个不定长的QString中提取部分字符串? [复制链接]

上一主题 下一主题
离线yzpdsg
 

只看楼主 倒序阅读 楼主  发表于: 2011-06-23
比如,有一个QString,它的内容非常多。
MediaInfoLib - v0.7.45Option not knownGeneral
Unique ID                        : 34706271566396063239680443737195398397 (0x1A1C2F4CE01B390F80CE545018E7C4FD)
Complete name                    : D:\3-D Sex And Zen.AVI
Format                           : Matroska
File size                        : 3.25 GiB
Duration                         : 1h 53mn
Overall bit rate                 : 4 101 Kbps
Writing application              : PotEncoder
Writing library                  : PotEncoder
Video
ID                               : 1
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : Baseline@L3.0
Format settings, CABAC           : No
Format settings, ReFrames        : 1 frame
Codec ID                         : V_MPEG4/ISO/AVC
Duration                         : 1h 53mn
Bit rate                         : 4 000 Kbps
Width                            : 1 280 pixels
Height                           : 720 pixels
Display aspect ratio             : 16:9
Frame rate mode                  : Variable
Frame rate                       : 29.970 fps
Color space                      : YUV
Chroma subsampling               : 4:2:0
Bit depth                        : 8 bits
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.145
Stream size                      : 3.08 GiB (95%)
Writing library                  : x264 core 112
Encoding settings                : cabac=0 / ref=1 / deblock=1:-1:-1 / analyse=0x1:0x111 / me=hex / subme=5 / psy=1 / psy_rd=0.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=0 / threads=24 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=250 / keyint_min=25 / scenecut=0 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=4000 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Language                         : English
Audio
ID                               : 2
Format                           : MPEG Audio
Format version                   : Version 1
Format profile                   : Layer 3
Mode                             : Joint stereo
Mode extension                   : MS Stereo
Codec ID                         : A_MPEG/L3
Codec ID/Hint                    : MP3
Duration                         : 1h 53mn
Bit rate mode                    : Constant
Bit rate                         : 128 Kbps
Channel(s)                       : 2 channels
Sampling rate                    : 48.0 KHz
Compression mode                 : Lossy
Delay relative to video          : 24ms
Stream size                      : 104 MiB (3%)
Writing library                  : LAME3.98.2
Language                         : English

现在我希望能把Video的信息和Audio的信息分别提取出来放入不同的textBrowser显示。该如何做呢?

离线dbzhang800

只看该作者 1楼 发表于: 2011-06-23
简单的字符串查找,或者正则表达式
离线uidab

只看该作者 2楼 发表于: 2011-06-23
回 楼主(yzpdsg) 的帖子
既然是QString 你可以看看里面的left,right,indexof,lastindexof,这是最普通的字符串查找。
有时候为了工作直接获得答案,而我却失去了思考的乐趣!


飘啊飘,何时能安居!
离线yzpdsg

只看该作者 3楼 发表于: 2011-06-24
回 2楼(uidab) 的帖子
谢谢,使用mid()+indexOf()解决了。
离线jptiancai

只看该作者 4楼 发表于: 2011-09-21
学习了!!
快速回复
限100 字节
 
上一个 下一个