在Dynamic ax 2012中拆分字符串

sku*_*sas 1 x++ axapta

我想拆分字符串.

1出现空字符串

2缺少零;

如果我的代码:

Question #1
    value = "001#$002#$003";
    strList = strsplit(value,"#$");
    result: "001", "", "002", "", "003";
    //if i using spliter like "$" it is ok. result:  "001", "002","003";

    Question #2
    str2con(value,"#$");
    result: "1", "2","3" missing zeros

FH-*_*way 5

仔细查看Global :: strSplit方法[AX 2012]Global :: str2con方法[AX 2012]的文档.备注部分包含您的问题的答案:

strSplit文件备注(我强调):

_delimiter字符串中的每个字符用于拆分_stringToSplit参数.

因此,您应strSplit首先使用#或$ 调用,然后使用删除其他符号strReplace.

str2con方法备注(由我强调):

在_convertNumericToInt64参数中,值为true表示如果返回的内容只有数字字符,则将转换为int64值.值false表示返回的值不会转换为int64值,String值始终为回._convertNumericToInt64参数的默认值为true.

所以没必要全部用俄语str2con_RU:)