NSBase: NSStringArraySortMBS

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

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.


💬 Ask a question or report a problem