融雲教程

  1. https://www.rongcloud.cn/downloads (下載地址)

  2. https://www.rongcloud.cn/docs/quick_start.html#faq (需要自己寫的功能)
    在這裏插入圖片描述

  3. https://www.rongcloud.cn/docs/server.html (Server 開發指南, java的server從這裏下載)

  4. https://developer.rongcloud.cn/app/appService/Kh/ATgVeAzRYx6RpgHw= (融雲控制檯)

  5. https://github.com/rongcloud/server-sdk-java/blob/master/README.md (後臺代碼舉例)

  6. (沒用) https://www.cnblogs.com/zhangwj/p/7717266.html (獲取漢字首字母)

  7. (部分字不正確) https://www.jianshu.com/p/1cb4ee64af32 (獲取漢字首字母)

  8. `public class PinyinUtil {
    /**

    • 得到 全拼
    • @param src
    • @return
      */
      public static String getPingYin(String src) {
      char[] t1 = null;
      t1 = src.toCharArray();
      String[] t2 = new String[t1.length];
      HanyuPinyinOutputFormat t3 = new HanyuPinyinOutputFormat();
      t3.setCaseType(HanyuPinyinCaseType.LOWERCASE);
      t3.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
      t3.setVCharType(HanyuPinyinVCharType.WITH_V);
      String t4 = “”;
      int t0 = t1.length;
      try {
      for (int i = 0; i < t0; i++) {
      // 判斷是否爲漢字字符
      if (java.lang.Character.toString(t1[i]).matches("[\u4E00-\u9FA5]+")) {
      t2 = PinyinHelper.toHanyuPinyinStringArray(t1[i], t3);
      t4 += t2[0];
      } else {
      t4 += java.lang.Character.toString(t1[i]);
      }
      }
      return t4;
      } catch (BadHanyuPinyinOutputFormatCombination e1) {
      e1.printStackTrace();
      }
      return t4;
      }

    /**

    • 得到中文首字母

    • @param str

    • @return
      */
      public static String getPinYinHeadChar(String str) {

      String convert = “”;
      for (int j = 0; j < str.length(); j++) {
      char word = str.charAt(j);
      String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word);
      if (pinyinArray != null) {
      convert += pinyinArray[0].charAt(0);
      } else {
      // 判斷是否爲英文字母
      if(String.valueOf(word).matches("[a-zA-Z]+")){ // 如果是英文字母
      // 添加英文字母
      convert += word;
      }else{ // 如果不是英文字母
      // 添加#
      convert += “#”;
      }
      }
      }
      return convert;
      }

    /**

    • 將字符串轉移爲ASCII碼
    • @param cnStr
    • @return
      */
      public static String getCnASCII(String cnStr) {
      StringBuffer strBuf = new StringBuffer();
      byte[] bGBK = cnStr.getBytes();
      for (int i = 0; i < bGBK.length; i++) {
      // System.out.println(Integer.toHexString(bGBK[i]&0xff));
      strBuf.append(Integer.toHexString(bGBK[i] & 0xff));
      }
      return strBuf.toString();
      }

    /**

    • @Author dongpeili
    • @Description 中文轉拼音, 獲取第一個字母
    • @Date 13:34 2019/6/27
    • @Param [cnStr]
    • @Return java.lang.String
      **/
      public static String getFirstChar(String cnStr){
      String headStr = getPinYinHeadChar(cnStr);
      return headStr.substring(0, 1);
      }

    public static void main(String[] args) {

    String cnStr = "凌";
    System.out.println(getPingYin(cnStr));
    System.out.println(getFirstChar(cnStr));
    System.out.println(getFirstChar("渣瓦"));
    System.out.println(getFirstChar("嘟嘟嚕"));
    System.out.println(getFirstChar("哎呀"));
    System.out.println(getFirstChar("報錯"));
    System.out.println(getFirstChar("asd"));
    System.out.println(getFirstChar("kjj"));
    System.out.println(getFirstChar("-="));
    

    }
    }`
    能用的

  9. https://www.rongcloud.cn/docs/server_sdk_api/group/group.html#join (官網接口文檔)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章