中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

免費(fèi)域名的網(wǎng)站百度可以發(fā)布廣告嗎

免費(fèi)域名的網(wǎng)站,百度可以發(fā)布廣告嗎,網(wǎng)站開發(fā)還有哪些,設(shè)計(jì)單網(wǎng)站建設(shè)1. 準(zhǔn)備一個逗號分割字符串 String str "小張,小王,小李,小趙";2. 逗號分割字符串轉(zhuǎn)換為集合(轉(zhuǎn)換為集合之前會先轉(zhuǎn)換為數(shù)組) // 第一種&#xff1a;先用split將字符串按逗號分割為數(shù)組&#xff0c;再用Arrays.asList將數(shù)組轉(zhuǎn)換為集合 List<String> strList…

1. 準(zhǔn)備一個逗號分割字符串

String str = "小張,小王,小李,小趙";

2. 逗號分割字符串轉(zhuǎn)換為集合(轉(zhuǎn)換為集合之前會先轉(zhuǎn)換為數(shù)組)

// 第一種:先用split將字符串按逗號分割為數(shù)組,再用Arrays.asList將數(shù)組轉(zhuǎn)換為集合
List<String> strList1 = Arrays.asList(str.split(","));
// 第二種:使用stream轉(zhuǎn)換String集合
List<String> strList2 = Arrays.stream(str.split(",")).collect(Collectors.toList());
// 第三種:使用stream轉(zhuǎn)換int集合(這種適用字符串是逗號分隔的類型為int類型)
List<Integer> intList = Arrays.stream(str.split(",")).map(Integer::parseInt).collect(Collectors.toList());
// 第四種:使用Guava的SplitterString
List<String> strList3= Splitter.on(",").trimResults().splitToList(str);
// 第五種:使用Apache Commons的StringUtils(只用到了他的split)
List<String> strList4= Arrays.asList(StringUtils.split(str,","));
// 第六種:使用Spring Framework的StringUtils
List<String> strList5 =Arrays.asList(StringUtils.commaDelimitedListToStringArray(str));

3. 集合轉(zhuǎn)換為逗號分隔的字符串

// 第一種:String.join(), JDK1.8+
str = String.join(",", strList1);
// 第二種:org.apache.commons.lang3.StringUtils. toArray():集合轉(zhuǎn)換為數(shù)組
str = StringUtils.join(strList1.toArray(), ",");
// 第三種:需要引入hutool工具包
str = Joiner.on(",").join(strList1);
// 第四種:StringJoiner, JDK1.8+ 輸出示例:START_小張,小王,小李,小趙_END
StringJoiner sj = new StringJoiner(",");
strList1.forEach(e -> sj.add(String.valueOf(e)));
// 在上面已經(jīng)處理為逗號拼接的字符串,下面為補(bǔ)充
// 在連接之前操作字符串, 拼接前綴和后綴
StringJoiner sj2 = new StringJoiner(",", "START_", "_END");
strList1.forEach(e -> sj2.add(String.valueOf(e)));
// 第五種:Stream, Collectors.joining(), JDK1.8+
str = strList1.stream().collect(Collectors.joining(","));
// 在連接之前操作字符串, 拼接前綴和后綴. 輸出示例:START_小張,小王,小李,小趙_END
str = strList1.stream().map(e -> {if (e != null) return e.toUpperCase();else return "null";
}).collect(Collectors.joining(",", "START_", "_END"));
// 第六種:使用Spring Framework的StringUtils
str = StringUtils.collectionToDelimitedString(strList1,",");

4. 數(shù)組轉(zhuǎn)逗號分隔字符串

String [] arr = (String[])strList1.toArray();
// 第一種:使用StringUtils的join方法
str = StringUtils.join(arr, ",");
// 第二種:使用ArrayUtils的toString方法,這種方式轉(zhuǎn)換的字符串首尾加大括號 輸出示例:{小張,小王,小李,小趙}
ArrayUtils.toString(arr, ",");
http://www.risenshineclean.com/news/47424.html

相關(guān)文章:

  • 個人備案網(wǎng)站做企業(yè)會怎樣湖南靠譜的關(guān)鍵詞優(yōu)化
  • 不用編程做APP和響應(yīng)式網(wǎng)站重慶seo排名方法
  • 靠譜的網(wǎng)站制作專業(yè)公司seo論壇
  • 易企秀網(wǎng)站開發(fā)杭州關(guān)鍵詞推廣優(yōu)化方案
  • wordpress集成微信收款seo服務(wù)銷售招聘
  • 惠州做網(wǎng)站免費(fèi)網(wǎng)站alexa排名查詢
  • 做網(wǎng)站推廣托管費(fèi)用seo網(wǎng)絡(luò)營銷推廣公司深圳
  • 微信網(wǎng)站制作軟件有哪些uc瀏覽網(wǎng)頁版進(jìn)入
  • 簡潔網(wǎng)站欣賞路由優(yōu)化大師
  • 使用php做的網(wǎng)站有哪些西安自助建站
  • 裝飾公司手機(jī)網(wǎng)站湖南網(wǎng)站seo地址
  • 做我韓國連續(xù)劇網(wǎng)站線上營銷技巧和營銷方法
  • asp.net 網(wǎng)站壓縮線下推廣宣傳方式有哪些
  • 網(wǎng)絡(luò)培訓(xùn)的網(wǎng)站建設(shè)搜索引擎優(yōu)化要考慮哪些方面
  • 網(wǎng)站標(biāo)題關(guān)鍵字營銷方案策劃書
  • 灌云縣建設(shè)局網(wǎng)站營銷公司
  • 海外推廣有前途嗎無錫seo網(wǎng)絡(luò)推廣
  • wordpress分享js代碼無錫網(wǎng)站seo顧問
  • 多城市網(wǎng)站如何做seo建立網(wǎng)站的步驟
  • 京東內(nèi)部券網(wǎng)站怎么做百度公司全稱
  • 好的做網(wǎng)站東莞百度推廣排名
  • 培訓(xùn)的網(wǎng)站建設(shè)鳴蟬智能建站
  • 怎樣看出一個網(wǎng)站是那個公司做的合肥百度推廣公司哪家好
  • 鄭州網(wǎng)站設(shè)計(jì)專家seo掛機(jī)賺錢
  • 北京國貿(mào)網(wǎng)站建設(shè)網(wǎng)絡(luò)優(yōu)化器下載
  • 網(wǎng)站制作公司承擔(dān)seo外包公司多嗎
  • 網(wǎng)站加關(guān)鍵詞代碼培訓(xùn)網(wǎng)站建設(shè)
  • 仿網(wǎng)站制作教學(xué)視頻網(wǎng)絡(luò)營銷與直播電商怎么樣
  • 四川成都營銷型網(wǎng)站數(shù)據(jù)分析網(wǎng)站
  • 網(wǎng)站建設(shè) 后端前端廣告聯(lián)盟平臺哪個好