- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2017 08:49 PM
I have 2 strings which contains comma separated sysid values.I want to calculate the difference between the 2 strings ..I am trying to acheive this using the diff function in the ArrayUtil.
To acheive this , how to convert string to array?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2017 08:54 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2017 08:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2017 08:57 PM
Hi Amala,
If you have two strings which contains comma separated sys id, you can create an Array and find difference using below code :
var arr1 = str1.split(',');
var arr2 = str2.split(',');
var arrUtil = new ArrayUtil();
gs.print(arrayUtil.diff(arr1, arr2));
Note that this will return item from arr1 that were not found in arr2
Thanks,
Mohammed Zeeshan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2017 09:02 PM
Hi Amala,
can you please share your code? i can try and give you the exact output that you need.
by the way you can refer the link below.
JavaScript string to array conversion - Stack Overflow
Thanks,
Harshvardhan