Splitting the String
I hope there no key word in SDK for splitting the string. Here i am sharing my attempt for splitting the string. If any improvement required in code or logic. If any of you have any alternate thought or any other technique which already exist in SDK. please let me know.
I hope SDK Experts Horst Schaude, Alessandro Iannacci, @Stefan Krauth …… has better coding or technique then this 🙂 .
Step 1: Reuse library for splitting the string. It has two importing parameters(STRING_QU_RE -> String to be split, SPLIT_QU_RE -> Splitting Variable, Return will be collection split strings ).
Step 2: Logic for splitting the string.
Step 3: Business object for testing the Reuse Library for splitting the string.
Step 4: Script for executing the Reuse Library.
Step 5: Testing the Business Object for splitting the string.
5.a: Input the String and Split Key
5.b: Click on Split String.
If this blog is help full. Please Share it, Like it and Comment it below 🙂 😆 😆 .
Thanks for sharing this information..........
Thanks Mithun Suthar
Thanks for sharing your work..
K. K. Nikhil.
Great!! Thanks for sharing .... 🙂
Great work Quddus.
Nice work Quddus ,
Thanks and regards ,
Lokesh Sai .
Very Much Thanks for sharing !!!
It is really helpful .
good work Quddus,
When I test in my test system, click on Split String, it raise:
this is very likely due some of the strings being empty/initial.
I debug it, when the function is running, the result is Ok.
But at the end of the fuction run, it raise 4 errors at con.Find() and 4 errors at con.Substring(), every time is not success?
for some reason, the script calls the substring method with a negative substring length: -16.
So there is some bug or missing length/string validity check in the script causing this error.
Please ask McQuddus to check and update the code.
Fixed a bug in the code
If anybody wants to copy & paste, this is my approach .
I did it a bit differently, because the original approach assumes that your split character is only 1 character long and that there is never a split character at the end of the string. (In the first case, that would leave you with the rest of your split character in the next line; in the second case, it would leave you with an extra line in the result.)
My import variables are:
IV_STRING : AP.Common.GDT::LANGUAGEINDEPENDENT_EXTENDED_Text;
IV_SPLIT_AT : AP.Common.GDT::LANGUAGEINDEPENDENT_EXTENDED_Text;
Also, the reuse function should be read-only so it can be used cross-deployment unit.