zoukankan      html  css  js  c++  java
  • 在Axapta中实现trim函数

    在Axapta中找了半天都没找到字符串的trim函数,用strFind和subStr写了一个,应该有更好的实现方式,先凑合着用吧.
    static void strTrim(args a)
    {
        
    int position;
        str srcStr;
        ;
        srcStr 
    = "         aaa aaa ";
        position 
    = 1;

        
    //left trim
        while(true)
        
    {
            position 
    = strFind(srcStr," ",1,1);
            
    if(!position)
                
    break;
            srcStr 
    = substr(srcStr,position+1,strlen(srcStr)-position);

        }

        
    //right trim
        while(true)
        
    {
            position 
    = strFind(srcStr," ",strlen(srcStr),1);
            
    if(!position)
                
    break;
            srcStr 
    = substr(srcStr,1,position-1);

        }

        print srcStr;
        pause;
    }

    补记:
    今天在System Document->Functions里找到了strlTrim和strrTrim两个函数,公用的系统函数解释都在这里放着在,有时间看一下,还是挺有用的,嗯.
    static void strTrim(Args _args)
    {
             str aa 
    = "   aa ";
             ;
             aa 
    = strltrim(aa);
             aa 
    = strrtrim(aa);
             print aa;
             pause;
    }
  • 相关阅读:
    DataGird导出EXCEL的几个方法
    csv文件与DataTable互相导入处理
    LeetCode 345
    LeetCode 168
    LeetCode 344
    LeetCode 342
    LeetCode 343
    LeetCode 326
    LeetCode 338
    LeetCode 319
  • 原文地址:https://www.cnblogs.com/Farseer1215/p/505087.html
Copyright © 2011-2022 走看看