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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何提取括號(圓括號)之間的文本?

如何提取括號(圓括號)之間的文本?

青春有我 2019-07-16 16:23:03
如何提取括號(圓括號)之間的文本?我有一根繩子User name (sales)我想提取括號中的文字,我該怎么做呢?我懷疑子字符串,但我不知道如何閱讀直到結(jié)束括號,長度的文本將有所不同。
查看完整描述

3 回答

?
湖上湖

TA貢獻2003條經(jīng)驗 獲得超2個贊

一個非常簡單的方法是使用正則表達式:

Regex.Match("User name (sales)", @"\(([^)]*)\)").Groups[1].Value

作為對(非常有趣的)評論的回應(yīng),下面是同樣的Regex,并給出一些解釋:

\(             # Escaped parenthesis, means "starts with a '(' character"
    (          # Parentheses in a regex mean "put (capture) the stuff 
               #     in between into the Groups array" 
       [^)]    # Any character that is not a ')' character
       *       # Zero or more occurrences of the aforementioned "non ')' char"
    )          # Close the capturing group\)             # "Ends with a ')' character"


查看完整回答
反對 回復(fù) 2019-07-16
  • 3 回答
  • 0 關(guān)注
  • 946 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

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

公眾號

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