Q
Problem solve Get help with specific problems with your technologies, process and projects.

Working with carets in code

What does the caret mean in the following line of code? @explode(@implode(ActionOwnerList; "^");"^")

The code will work as written but doesn't really make sense. It's redundant.

The @Implode function takes a list (or array) and converts it into a string. The function has two arguments: list and separator. List is the list you want to implode into a string, and separator is the character (or string of characters) you want to insert in between the elements when the string is created.

@Explode does the exact opposite of @Implode. It creates a list (or array) from a string. It also has an optional argument called separator. The separator argument in @Explode directs the function on what to consider the end of one element and the beginning of the next. For example...

** The two functions below would return the same thing

** @Explode("Red^Blue^Green", "^")

** @Explode("Red Blue Green )

** They would both return a list like this, "Red":"Blue":"Green"

So.....

Assume you have the following variable... (Note it is a list [or array if you prefer])

** ActionOwnerList = "Kevin Ford":"Shari Brennan":""Kara Gattine"

If you ran @Implode (WITHOUT the separator argument, i.e. the caret) against that variable, the result would be a text string that looked like this,

** Result = "Kevin FordShari BrennanKara Gattine".

** Problem is now you can't break it apart again because Notes can't tell where one ends and the next begins.

If you ran @Implode (WITH the separator argument) against that variable, the result would be the same string as in the previous example but using a caret between the original list elements.

** Result = "Kevin Ford^Shari Brennan^Kara Gattine"

** Now, we have a string like in the previous example, but there is a ^ everywhere a new element begins.

Now you understand the two functions. They are used commonly to manipulate text with functions only available to one variable type. For example, there are built in notes functions for manipulating Text Lists that don't exist for text strings. So I can convert a string to a list, manipulate the data, then convert it back to a string.

The function that you sent me is completely redundant, unless the original list (ActionOwnerList) contained ^ character. Even so, the same result could be had by simply using @Explode(ActionOwnerList; "^").

It is the equivalent of.....

A = 5 + (5 - 5)

That should explain the functions fully to you.


Dig Deeper on Domino Resources - Part 7

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close