You need to sign in to do that
Don't have an account?
AlexPHP
Is there a List/Set join() / implode() method?
I'm looking for a method that will have a join/implode functionality.
I cannot seem to find an equivalent in the docs. Does one exist in APEX?
Thanks
Not in the PHP/Java/Perl/Ruby/JavaScript/insert-favorite-scripting-language-here sense of the meaning. You'd have to do this:
You can use the same with Sets as well.
This is an answer to an old post, but it is available not in Apex but in the apex-lang utility code library from Google inspired by the Apache Commons Lang project. The above reply also works I guess but I noticed this lib also gives a lot of other useful functions and even has a csv parser. So..
http://code.google.com/p/apex-lang/
I found it myself now and am just installing it, but there are several methods filling the description in there, inside StringUtils.
http://code.google.com/p/apex-lang/source/browse/trunk/eclipse-project/src/classes/StringUtils.cls
http://richardvanhook.com/2009/05/05/getting-started-with-apex-lang/
Here's a sample:
global static String joinArray(Object[] objectArray, String separator) {
if (objectArray == null) {
return null;
}
return joinArray(objectArray, separator, 0, objectArray.size());
}
This will return Most likely, this is added in a later API, but I thought it would be good to add this information to this open discussion.
The apex-lang plugin looks like it could be really useful but...
The third link to the richardvanhook website insists that you install a Chrome browser security plugin before you can access the content.
Legit sites don't do this!
If you visit the root of the website, there are loads of browser warnings - it looks like the site has been well and truly compromised and is now full of malware. Be careful - this site is also linked to from the Wiki section of the app's Project website.
Is apex-lang safe to install anymore? I don't know, but I'm not going to risk it! It also has not been updated since 2012, which is a pity - much of the functionality I think is still missing from Apex.
So much for the promise, on the project home page, of many more updates per year than SF's 3 or 4!