Platforms to show: All Mac Windows Linux Cross-Platform

NSStringArraySortMBS(texts() as string, options as Integer) as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method Cocoa MBS Main Plugin 16.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Sorts array of string with options.
Example
// constants for the function:
const NSCaseInsensitiveSearch = 1
const NSLiteralSearch = 2
const NSBackwardsSearch = 4
const NSAnchoredSearch = 8
const NSNumericSearch = 64
const NSDiacriticInsensitiveSearch = 128
const NSWidthInsensitiveSearch = 256
const NSForcedOrderingSearch = 512

const NSOrderedAscending = -1
const NSOrderedSame = 0
const NSOrderedDescending = 1

// test array

dim a() as string = array("Test 1", "Test 2", "Test 12")

// sort with Cocoa sorting
dim r() as string = NSStringArraySortMBS(a, NSDiacriticInsensitiveSearch + _
NSWidthInsensitiveSearch + _
NSCaseInsensitiveSearch + _
NSNumericSearch)

// sort with xojo
a.sort

// show result
MsgBox "Cocoa: "+Join(r,", ")+EndOfLine+_
"Xojo: "+Join(a, ", ")

This function allows you to use NSStringCompareMBS for array sorting.

Blog Entries

The items on this page are in the following plugins: MBS Main Plugin.


The biggest plugin in space...