Sample code for 30+ languages & platforms
PowerBuilder

Get MessageSet IDs as a Comma-Separated String

See more IMAP Examples

Demonstrates the Chilkat MessageSet.ToCommaSeparatedStr method, which returns the unique identifiers as a comma-separated string in ascending numeric order. It takes no arguments; an empty set returns an empty string. This example inserts a few ids and prints them.

Background: This is the fully expanded, human-readable form — every identifier listed explicitly, such as 1,2,3,5. It is handy for logging or display. When you need the terse form that collapses consecutive runs into ranges (for example 1:3,5), use ToCompactString instead. Like the compact form, the returned string contains only the numeric values and not the HasUids setting.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_MsgSet
string ls_Csv

//  Demonstrates the MessageSet.ToCommaSeparatedStr method, which returns the unique identifiers
//  as a comma-separated string in ascending numeric order.  It takes no arguments.

loo_MsgSet = create oleobject
li_rc = loo_MsgSet.ConnectToNewObject("Chilkat.MessageSet")
if li_rc < 0 then
    destroy loo_MsgSet
    MessageBox("Error","Connecting to COM object failed")
    return
end if

//  Build a set by inserting individual identifiers.  The insertion order does not matter;
//  the identifiers are kept in ascending order and duplicates are ignored.
loo_MsgSet.InsertId(3)
loo_MsgSet.InsertId(1)
loo_MsgSet.InsertId(2)
loo_MsgSet.InsertId(5)

//  Get the identifiers as a comma-separated string.
ls_Csv = loo_MsgSet.ToCommaSeparatedStr()
Write-Debug ls_Csv
//  Output: 1,2,3,5


destroy loo_MsgSet