在 Dynamic ax 2012 中拆分字符串
Split string in Dynamic ax 2012
我想拆分字符串。
1 出现空串
2 个零;
如果我的代码:
Question #1
value = "001#[=10=]2#[=10=]3";
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
我发现第二个问题的答案本身可能对其他人有用。
str2con_RU(价值,"#$");
仔细查看 Global::strSplit Method [AX 2012] and Global::str2con Method [AX 2012] 的文档。备注部分包含您问题的答案:
strSplit
文档的备注(我强调):
Each character in the _delimiter string is used to split the _stringToSplit parameter.
所以您应该先用# 或$ 调用strSplit
,然后用strReplace
删除另一个符号。
str2con
方法备注(本人强调):
In the _convertNumericToInt64 parameter, a value of true indicates the returned contents will be converted to an int64 value if they only have numeric characters.A value of false indicates that the returned values will not be converted to an int64 value and String values will always be returned. The default value of the _convertNumericToInt64parameter is true.
所以没必要全俄语 str2con_RU
:)
我想拆分字符串。
1 出现空串
2 个零;
如果我的代码:
Question #1 value = "001#[=10=]2#[=10=]3"; 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
我发现第二个问题的答案本身可能对其他人有用。
str2con_RU(价值,"#$");
仔细查看 Global::strSplit Method [AX 2012] and Global::str2con Method [AX 2012] 的文档。备注部分包含您问题的答案:
strSplit
文档的备注(我强调):
Each character in the _delimiter string is used to split the _stringToSplit parameter.
所以您应该先用# 或$ 调用strSplit
,然后用strReplace
删除另一个符号。
str2con
方法备注(本人强调):
In the _convertNumericToInt64 parameter, a value of true indicates the returned contents will be converted to an int64 value if they only have numeric characters.A value of false indicates that the returned values will not be converted to an int64 value and String values will always be returned. The default value of the _convertNumericToInt64parameter is true.
所以没必要全俄语 str2con_RU
:)