Platforms to show: All Mac Windows Linux Cross-Platform

Back to CFStringMBS class.

CFStringMBS.Character(index as Integer) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the character from this string with the given index.

The returned Xojo string contains a Unicode character.

CFStringMBS.Characters(pos as Integer,len as Integer) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the characters from this string in the given range.

The returned Xojo string contains Unicode characters.

CFStringMBS.Compare(other as CFStringMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 3.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Compares two strings.

Return values:
Less Than-1
Equal To0
Greater Than1
Function not available-2

See also:

CFStringMBS.Compare(other as CFStringMBS, CaseInsensitive as boolean) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 2.8 ✅ Yes ❌ No ❌ No ✅ Yes All
Compares two strings.

Return values:
Less Than-1
Equal To0
Greater Than1
Function not available-2

See also:

CFStringMBS.Compare(other as CFStringMBS, CaseInsensitive as boolean, Numerically as boolean) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 3.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Compares two strings.
Example
dim s as CFStringMBS
dim t as CFStringMBS
dim n1,n2 as Integer

s=NewCFStringMBS("Hello7.txt")
t=NewCFStringMBS("Hello10.txt")
n1=s.Compare(t,false)

n2=s.Compare(t,false,true)

MsgBox "Without nummerical: "+str(n1)+", With nummerical: "+str(n2)+"."

Numerically works only if Mac OS X 10.2 or newer is running.

Return values:
Less Than-1
Equal To0
Greater Than1
Function not available-2

See also:

CFStringMBS.Compare(other as CFStringMBS, Options as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 7.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Compares two strings.
Example
// Just a quick and dirty test for this function:

dim s(10) as string
dim i as Integer
dim temp as string
dim isDirty as boolean
dim a,b as CFStringMBS

s(1)="Apfel"
s(2)="Strasse"
s(3)="Bäum"
s(4)="Straße"
s(5)="Zaun"
s(6)="äpfel"
s(7)="bäum"
s(8)="Baum"
s(9)="Äpfel"
s(10)="Ende"

// if kCFCompareLocalized is used, the Äpfel come near Apfel.

const kCFCompareCaseInsensitive = 1
const kCFCompareBackwards = 4 //* Starting from the end of the string */
const kCFCompareAnchored = 8 //* Only at the specified starting point */
const kCFCompareNonliteral = 16 //* If specified, loose equivalence is performed (o-umlaut == o, umlaut) */
const kCFCompareLocalized = 32 //* User's default locale is used for the comparisons */
const kCFCompareNumerically = 64 //* Numeric comparison is used; that is, Foo2.txt < Foo7.txt < Foo25.txt */

'Sortieren
do
isDirty = false// we haven't touched anything yet
for i = 1 to 10-1// loop through all the numbers

a=NewCFStringMBS(s(i))
b=NewCFStringMBS(s(i+1))

if a.Compare(b,kCFCompareLocalized)>0 then
temp = s(i+1)
s(i+1) = s(i)
s(i) = temp
isDirty = true// we touched the data so mark it as dirty
end
next
loop until isDirty = false// if we made it without touching the data thenwe are done


for i=1 to 10
EditField1.text=EditField1.text + s(i) + chr(13)
next i

Numerically works only if Mac OS X 10.2 or newer is running.

Return values:
Less Than-1
Equal To0
Greater Than1
Function not available-2

See also:

CFStringMBS.Constructor(text as string = "")

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 13.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new CFString.
Example
dim c as new CFStringMBS("Hello")
MsgBox c

CFStringMBS.Edit as CFMutableStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a mutable string.

CFStringMBS.ExactFind(stringtofind as CFStringMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Finds the given string.

Exactly, so case sensitive.

CFStringMBS.Find(stringtofind as CFStringMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Finds the given string.

CFStringMBS.HasPrefix(s as CFStringMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Does this string start with s.

CFStringMBS.HasSuffix(s as CFStringMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Does this string end with s.

CFStringMBS.Mid(pos as Integer,len as Integer) as CFStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new CFStringMBS with a substring from the current CFStringMBS.

Compare to Mid in RB.

CFStringMBS.Normalize(NormalizationForm as Integer) as CFMutableStringMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Normalizes the string into the specified form as described in Unicode Technical Report #15.
Example
const kCFStringNormalizationFormD  = 0 // Canonical Decomposition
const kCFStringNormalizationFormKD = 1 // Compatibility Decomposition
const kCFStringNormalizationFormC = 2 // Canonical Decomposition followed by Canonical Composition
const kCFStringNormalizationFormKC = 3 // Compatibility Decomposition followed by Canonical Composition

dim s as CFStringMBS
dim m as CFMutableStringMBS

s=NewCFStringMBS("Hello é")
m=s.Normalize(kCFStringNormalizationFormD)

MsgBox str(s.Len)+" "+str(m.len)

// decomposed the length is one more.

Requires Mac OS X 10.2 or newer.
Returns nil on any error.

CFStringMBS.Operator_Convert as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.0 ✅ Yes ❌ No ❌ No ✅ Yes All
An internal method for Xojo 5.x.
Example
dim s as cfstringmbs
s=NewCFStringMBS("Hello")
msgbox s

This method is used by Xojo 5.x to allow you to directly create a Xojo string based on a CoreFoundation string.
Xojo may create a NilObjectException if the cfstring object is nil.

See also:

CFStringMBS.Operator_Convert(v As String)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation MBS MacCF Plugin 4.0 ✅ Yes ❌ No ❌ No ✅ Yes All
An internal method for Xojo 5.x.
Example
dim s as cfstringmbs
s="Hello"
// replaces: s=NewCFStringMBS("Hello")

This method is used by Xojo 5.x to allow you to directly create a corefoundation string object based on a Xojo string.

See also:

CFStringMBS.Str as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
property CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the string data as Xojo string.

Returns the string in a one byte encoding. If possible ASCII string, else if possible MacRoman encoded else UTF8.
(Read and Write computed property)

CFStringMBS.UStr as String   Deprecated

Type Topic Plugin Version macOS Windows Linux iOS Targets
property CoreFoundation MBS MacCF Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
This item is deprecated and should no longer be used. You can use Str instead.
Returns the string data as Xojo unicode string (16bit).

If the string can not be returned as an unicode string, this function returns it as a normal string in System script (e.g. MacRoman).
(Read and Write computed property)

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


The biggest plugin in space...