zoukankan      html  css  js  c++  java
  • 函数单词首字母大写并返回字符串

    static void strFirstUpr(Args _args)
    {
        container strFirstUpr(str _str)
        {
            container conRet;
            int         i;
            str         strTmp;
            ;
            conRet = NJ_MF_str2con(_str," ");
          for(i=1;i<=conlen(conRet);i++)
          {
            strTmp = conpeek(conRet,i);
            strTmp = strlwr(strTmp);
            strTmp = strupr(SubStr(strTmp,1,1))+Substr(strTmp,2,StrLen(strTmp));
            conret = conpoke(conRet,i,strTmp);
            print conpeek(conret,i);
          }
          return conRet;
        }
        str strFirstUpr2(str _str)
        {
            str tmp,retStr;
            int i;
            boolean firstStr;
            ;
            firstStr = true;
            tmp = strLwr(_str);
            for (i=1; i<=strlen(tmp); i++)
            {
                if(firstStr)
                {
                 retStr += strUpr(substr(tmp,i,1));
                }
                else
                {
                    retStr += substr(tmp,i,1);
                }
                if(substr(tmp,i,1) == " ")
                    firstStr = true;
                else
                    firstStr = false;
            }
            return retStr;
        }
        ;
        print strFirstUpr2("HELLO yOu yes   hAO AN NOT,");
        pause;
    }

  • 相关阅读:
    关于天气插件代码
    新的起点了
    如何实现按下回车键实现搜索

    random模块
    循环导入问题
    模块的搜索路径
    import 和from…import
    模块四种形式
    面向过程编程
  • 原文地址:https://www.cnblogs.com/perock/p/2252895.html
Copyright © 2011-2022 走看看