Xojo Conferences
MBSOct2019CologneDE

Platforms to show: All Mac Windows Linux Cross-Platform

Next items

StringHandleMBS.Add(data as MemoryBlock)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 19.1 Yes Yes Yes Yes No
Function: Adds data from memoryblock to the string handle.

See also:

Feedback, Comments & Corrections

StringHandleMBS.Add(data as Ptr, size as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 19.1 Yes Yes Yes Yes No
Function: Adds data from ptr to the string handle with given size.
Notes: Using invalid Ptr or size combination can cause a crash.

See also:

Feedback, Comments & Corrections

StringHandleMBS.Add(data as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: Adds the string at the end of the current data.
Notes: Note that all strings added must have the same encoding.

See also:

Feedback, Comments & Corrections

StringHandleMBS.AddByte(value as UInt8)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 19.2 Yes Yes Yes Yes No
Function: Adds a byte to the string handle.

Feedback, Comments & Corrections

StringHandleMBS.AddInteger(value as Int64)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 19.2 Yes Yes Yes Yes No
Function: Adds a integer value to the string handle.
Notes: This is like AddString(str(value)).

Feedback, Comments & Corrections

StringHandleMBS.clone as StringHandleMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: Creates a new StringHandleMBS object with the same content.

Feedback, Comments & Corrections

StringHandleMBS.Constructor
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: The constructor of this class.

See also:

Feedback, Comments & Corrections

StringHandleMBS.Constructor(initvalue as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: The second constructor of this class which sets the value directly to the given Xojo string.
Example:
// An utility function you can define in a module:

Function BinaryReplaceAll(s as string, a as string,b as string) As string
dim h as StringHandleMBS

h=new StringHandleMBS(s)
h.ReplaceAll(a,b)

Return h.Copy
End Function

See also:

Feedback, Comments & Corrections

StringHandleMBS.Copy as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: Returns the content as a Xojo string.
Notes: This string will have the encoding set in the encoding property.

Feedback, Comments & Corrections

StringHandleMBS.CopyMemory as MemoryBlock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 19.1 Yes Yes Yes Yes No
Function: Copies content of handle in new memoryblock.

Feedback, Comments & Corrections

StringHandleMBS.Delete(start as Integer, lengthBytes as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: Deletes the bytes within the range.
Notes:
One based like RB's string functions.
The start and length parameters use bytes not charcters as unit. You can use the Copy method to get a RB string for characterwise editing.

Feedback, Comments & Corrections

StringHandleMBS.Extract(start as Integer, lengthBytes as Integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: Returns a part of the string.
Notes:
One based and the returned part is removed form the string data.
The start and length parameters use bytes not charcters as unit. You can use the Copy method to get a RB string for characterwise editing.

Feedback, Comments & Corrections

StringHandleMBS.FindByte(value as UInt8) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 19.2 Yes Yes Yes Yes No
Function: Finds position of a given value.
Example:
Dim s As New StringHandleMBS("Hello")

// 64 = big letters
// +32 = small letters
// + 5 = for 5th letter in alphabet

Dim c As Integer = 64+32+5
Dim p As Integer = s.FindByte(c)

MsgBox "position "+Str(p)+" for letter e"
Notes:
Returns one based byte offset.
Result is 0 if not found.

Feedback, Comments & Corrections

StringHandleMBS.FirstNonWhiteSpace(StartByteOffset as Integer = 1) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 19.2 Yes Yes Yes Yes No
Function: Finds first non-whitespace byte in the data starting at given offset.
Example:
Dim s As New StringHandleMBS("Hello World")
Dim p As Integer = s.FirstWhiteSpace(1)
Dim x As Integer = s.FirstNonWhiteSpace(p+1)

MsgBox "position "+Str(p)+" for white space and "+Str(x)+" for following text"
Notes:
StartByteOffset is one based.
White space are space, tab and new line characters.
Returns 0 if not found.

Feedback, Comments & Corrections

StringHandleMBS.FirstWhiteSpace(StartByteOffset as Integer = 1) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 19.2 Yes Yes Yes Yes No
Function: Finds first whitespace byte in the data starting at given offset.
Example:
Dim s As New StringHandleMBS("Hello World")
Dim p As Integer = s.FirstWhiteSpace(1)
Dim x As Integer = s.FirstNonWhiteSpace(p+1)

MsgBox "position "+Str(p)+" for white space and "+Str(x)+" for following text"
Notes:
StartByteOffset is one based.
White space are space, tab and new line characters.
Returns 0 if not found.

Feedback, Comments & Corrections

StringHandleMBS.Insert(data as string, position as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: Inserts the string data at the given byte position.
Notes:
One based.
Note that on Unicode the character position and the byte position are not equal!
(On 16bit Unicode charpos=2*bytepos and on US ASCII charpos=bytepos)

The position parameter uses bytes not charcters as unit. You can use the Copy method to get a RB string for characterwise editing.

Feedback, Comments & Corrections

StringHandleMBS.InStr(OffsetBytes as Integer = 1, target as String, EndOffsetBytes as Integer = -1) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: Searches for a binary string inside the StringHandle.
Example:
// We test if RB returns the same values as the plugin

dim s as String
dim h as StringHandleMBS

s="Christian"
h=new StringHandleMBS

h.Add s

MsgBox "MBS: "+str(h.InStr("is"))+", RB: "+str(InStr(s,"is"))
MsgBox "MBS: "+str(h.InStr(5,"ia"))+", RB: "+str(InStr(5,s,"ia"))
MsgBox "MBS: "+str(h.InStr("xy"))+", RB: "+str(InStr(s,"xy"))
Notes:
The same as InStr but with a second parameter to specify the start of the search inside the string handled.

The srcOfs parameter uses bytes not charcters as unit. You can use the Copy method to get a RB string for characterwise editing.

Returns positive value if something is found and zero in case nothing is found.
Returns negative value in case of error.
Casesensitive search!

Feedback, Comments & Corrections

StringHandleMBS.InStrUTF8(OffsetCharacters as Integer = 1, target as String, EndOffsetCharacters as Integer = -1) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 19.1 Yes Yes Yes Yes No
Function: Searches for a binary string inside the StringHandle.
Example:
Dim sh As New StringHandleMBS
sh.Encoding = sh.encodingUTF8 // so copy gives right encoding

sh.Add "Ä test Hello Word äöü test string."

Dim s As String = sh.Copy

MsgBox "position of text: "+Str(sh.InStr(5,"test"))+"/"+Str(s.InStrB(5,"test"))+"th byte "+_
"or "+Str(sh.InStrUTF8(5,"test"))+"/"+Str(s.InStr(5,"test"))+"th character"
Notes:
This function uses UTF8 characters instead of bytes as unit.
Returns positive value if something is found and zero in case nothing is found.
Returns negative value in case of error.
The same as InStrUTF8 but with a second parameter to specify the start of the search inside the string handle.
Casesensitive search!

Feedback, Comments & Corrections

StringHandleMBS.Left(lengthBytes as Integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: Returns a copy of the first left bytes of the string.
Notes:
May return less strings if the stored string is not long enough.

The length parameter uses bytes not charcters as unit. You can use the Copy method to get a RB string for characterwise editing.

Feedback, Comments & Corrections

StringHandleMBS.LeftUTF8(lengthCharacter as integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 19.1 Yes Yes Yes Yes No
Function: Queries given number of characters from string from the left side.
Example:
Dim s As String = "Hello öäü!"
Dim d As New StringHandleMBS(s)

d.Encoding = d.encodingUTF8

// ö is two bytes
MsgBox d.LeftUTF8(8)+" in UTF8 and "+d.Left(8)+" in bytes"

Feedback, Comments & Corrections

StringHandleMBS.Mid(startByte as Integer, lengthBytes as Integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: Returns a part of the string.
Notes:
One based.
The length parameter uses bytes not charcters as unit. You can use the Copy method to get a RB string for characterwise editing.

Feedback, Comments & Corrections

StringHandleMBS.MidInteger(startByte As Integer, lengthBytes As Integer = -1) as Int64
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 19.2 Yes Yes Yes Yes No
Function: Converts some bytes read as ASCII text to number.
Example:
Dim s As New StringHandleMBS("123456789")

Dim v As Integer = s.MidInteger(3,3)
MsgBox str(v)
Notes: startByte is one based.

Feedback, Comments & Corrections

StringHandleMBS.MidUTF8(startCharacter as integer, lengthCharacter as integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 19.1 Yes Yes Yes Yes No
Function: Queries characters from UTF-8 string with given characters.
Example:
Dim s As String = "Hello öäü!"
Dim d As New StringHandleMBS(s)

d.Encoding = d.encodingUTF8

// ö is two bytes
MsgBox d.MidUTF8(7,4)+" in UTF8 and "+d.Mid(7,4)+" in bytes"
Notes: startCharacter starts with 1 as in Xojo's mid function.

Feedback, Comments & Corrections

StringHandleMBS.Replace(a as String, b as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: Replaces the first string found with content of a with the content of b.
Example:
dim s as StringHandleMBS

s=new StringHandleMBS

s.Add "Hallo Leutle, Hellau"

s.Replace("H","h")
s.Replace("l","i")

MsgBox s.Copy+" "+str(s.Len)
Notes:
Note that all strings are compared binary and must have the same encoding.
Basicly this is just a call to instr, one to delete and one to insert.

See also:

Feedback, Comments & Corrections

StringHandleMBS.Replace(startpos as Integer, a as String, b as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: Replaces the first string found with content of a with the content of b.
Notes:
If you don't give a startpos parameter the call uses one and is equal to Replace(a,b).
Startpos is one based like all indexes in this class.
The startpos parameter uses bytes not charcters as unit. You can use the Copy method to get a RB string for characterwise editing.

See also:

Feedback, Comments & Corrections

StringHandleMBS.ReplaceAll(a as String, b as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: Replaces all strings with content of a with the content of b.
Example:
dim s as StringHandleMBS

s=new StringHandleMBS

s.Add "Hallo Leutle, Hellau"

s.Replaceall("H","h")
s.Replaceall("l","i")

MsgBox s.Copy+" "+str(s.Len)
Notes:
Note that all strings are compared binary and must have the same encoding.
Basicly this is just a loop with calls to instr, to delete and to insert.

See also:

Feedback, Comments & Corrections

StringHandleMBS.ReplaceAll(startpos as Integer, a as String, b as string)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: Replaces all strings with content of a with the content of b.
Notes:
If you don't give a startpos parameter the call uses one and is equal to ReplaceAll(a,b).
Startpos is one based like all indexes in this class.

The startpos parameter uses bytes not charcters as unit. You can use the Copy method to get a RB string for characterwise editing.

See also:

Feedback, Comments & Corrections

StringHandleMBS.Reverse as StringHandleMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 19.2 Yes Yes Yes Yes No
Function: Reverses bytes in string.
Example:
Dim s As New StringHandleMBS("Hello")
Dim r As StringHandleMBS = s.Reverse

MsgBox r.Copy
Notes: Returns copy of the string with reversed order.

Feedback, Comments & Corrections

StringHandleMBS.Right(lengthBytes as Integer) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method String MBS DataTypes Plugin 3.1 Yes Yes Yes Yes No
Function: Returns a copy of the first right bytes of the string.
Example:
// There was a small bug in the Right and the Mid function for the version 3.1 of this plugin.
// This test failed in 3.1, but works in 3.2:

dim Text as StringhandleMBS
dim Part as String

Text = New StringHandleMBS
Text.Add "." + chr(13) + chr(10)

Part = Text.Copy
' Now Part is ".<CR><LF" which is correct

if lenb(Part)<>3 then
MsgBox "Failed on Copy "+str(lenb(Part))
end if

Part = Text.Right(1)
' Now Part is "<LF>" which is correct

if lenb(Part)<>1 then
MsgBox "Failed on Right(1) "+str(lenb(Part))
end if

Part = Text.Right(2)
' Now Part is "<CR><LF>" which is correct

if lenb(Part)<>2 then
MsgBox "Failed on Right(2) "+str(lenb(Part))
end if

Part = Text.Right(3)
' Now Part is "" which is wrong!

if lenb(Part)<>3 then
MsgBox "Failed on Right(3) "+str(lenb(Part))
end if
Notes:
May return less strings if the stored string is not long enough.
The length parameter uses bytes not charcters as unit. You can use the Copy method to get a RB string for characterwise editing.

Feedback, Comments & Corrections

Next items

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




Links
MBS Xojo Chart Plugins