Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

cloneMemoryBlockMBS(s as memoryblock) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Basic MBS Util Plugin Yes Yes Yes Yes No
Function: Clones the memoryblock.
Example:
dim m as MemoryBlock = "Hello"
dim n as MemoryBlock = cloneMemoryBlockMBS(m)

m.Byte(1)=asc("a")
n.Byte(1)=asc("u")

dim a as string = m
dim b as string = n

MsgBox a+" "+b
Notes: May return nil on low memory conditions.

Feedback, Comments & Corrections

cloneMemoryBlockWithLengthMBS(s as memoryblock,len as Integer) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Basic MBS Util Plugin Yes Yes Yes Yes No
Function: Clones the memoryblock.
Example:
dim m as MemoryBlock = "Hello"
dim n as MemoryBlock = cloneMemoryBlockWithLengthMBS(m,5)

m.Byte(1)=asc("a")
n.Byte(1)=asc("u")

dim a as string = m
dim b as string = n

MsgBox a+" "+b
Notes: May return nil on low memory conditions.

Feedback, Comments & Corrections

cloneStringMBS(s as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Basic MBS Util Plugin Yes Yes Yes Yes No
Function: Clones the string.
Notes:
May return "" on low memory conditions.
The encoding of the string is copied in RB 4.5 or newer.

Feedback, Comments & Corrections

GetEncodingOfStringMBS(s as string) as UInt32
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Basic MBS Util Plugin Yes Yes Yes Yes No
Function: Returns the internal value for the encoding.
Example:
dim s as string = "Hello"

MsgBox hex(GetEncodingOfStringMBS(s)) // shows 8000100 for UTF8
Notes:
Only useful on Realbasic 4.5 and newer.
Some example values for encoding:
MacRoman 0Also for ASCII or binary data used.
WindowsLatin1&h0500ANSI codepage 1252
ISOLatin1&h0201ISO 8859-1
NextStepLatin&h0B01NextStep encoding
Unicode &h010016 bit Unicode
UTF8&h080001008 bit Unicode
Invalid&hFFFFFFFF(Binary)
Invalid&hFFFF(Binary)

Renamed from GetStringEncoding to GetEncodingOfString in MBS Plugin 3.1.

Some examples using this method:

Feedback, Comments & Corrections

MemoryBlockToStringMBS(s as memoryblock) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Basic MBS Util Plugin Yes Yes Yes Yes No
Function: Returns a copy of the content of the memoryblock as a string.
Example:
dim m as MemoryBlock = NewMemoryBlock(6)

m.CString(0)="Hello"

MsgBox MemoryBlockToStringMBS(m)
Notes:
May return "" on low memory conditions.
As some memoryblocks don't have a known length, you can provide one as a second parameter.

Some examples using this method:

Feedback, Comments & Corrections

MemoryBlockToStringWithLengthMBS(s as memoryblock,len as Integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Basic MBS Util Plugin Yes Yes Yes Yes No
Function: Returns a copy of the content of the memoryblock as a string.
Example:
dim m as MemoryBlock = NewMemoryBlock(6)

m.CString(0)="Hello"

MsgBox MemoryBlockToStringWithLengthMBS(m,5)
Notes:
May return "" on low memory conditions.
As some memoryblocks don't have a known length, you can provide one as a second parameter.

Feedback, Comments & Corrections

OSTypeFromStringMBS(str as string) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Basic MBS Util Plugin 2.8 Yes Yes Yes Yes No
Function: Returns an integer representing a 4 byte String.
Example:
MsgBox str(OSTypeFromStringMBS("MBSP"))
Notes:
This OSType datatype is used on Mac OS for 4 letter codes.
e.g. the type and creator code for a file.

Some examples using this method:

Feedback, Comments & Corrections

SetEncodingOfStringMBS(s as string, encoding as UInt32)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Basic MBS Util Plugin Yes Yes Yes Yes No
Function: Sets the internal value for the encoding of this string.
Example:
dim s as string = "äöü"
dim t as string = ConvertEncoding(s, encodings.UTF16)
dim m as MemoryBlock = t // memoryblock has bytes from UTF16 string without knowning the encoding
dim u as string = m // convert back to a string without encoding

MsgBox u // shows wrong characters
SetEncodingOfStringMBS u, 256 // set to UTF-16
MsgBox u
Notes:
Only useful on Realbasic 4.5 and newer.
Some example values for encoding:
MacRoman 0Also for ASCII or binary data used.
WindowsLatin1&h0500ANSI codepage 1252
ISOLatin1&h0201ISO 8859-1
NextStepLatin&h0B01NextStep encoding
Unicode &h010016 bit Unicode
UTF8&h080001008 bit Unicode
Invalid&hFFFFFFFF(Binary)
Invalid&hFFFF(Binary)

Renamed from SetStringEncoding to SetEncodingOfString in MBS Plugin 3.1.

Some examples using this method:

Feedback, Comments & Corrections

StringFromOSTypeMBS(value as Integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Basic MBS Util Plugin 2.8 Yes Yes Yes Yes No
Function: Returns a 4 byte string for the given integer.
Example:
MsgBox StringFromOSTypeMBS(1296192336) // shows MBSP
Notes:
This OSType datatype is used on Mac OS for 4 letter codes.
e.g. the type and creator code for a file.

Some examples using this method:

Feedback, Comments & Corrections

StringToMemoryBlockMBS(s as string) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Basic MBS Util Plugin Yes Yes Yes Yes No
Function: Returns a copy of the content of the string as a memoryblock.
Example:
dim m as MemoryBlock = StringToMemoryBlockMBS("Hello")

MsgBox m.StringValue(0,5)
Notes: May return nil on low memory conditions.

Some examples using this method:

Feedback, Comments & Corrections

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




Links
MBS FileMaker Plugins