Platforms to show: All Mac Windows Linux Cross-Platform

ClearStringContentMBS(s as String) as Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method String MBS Util Plugin 19.5 Yes Yes Yes Yes No
Function: Clears string content.
// this is a constant string
Dim c As String = "Hello"

// this is an allocated string
Dim a As String = c + "World"

// try to clear both
Call ClearStringContentMBS c
Call ClearStringContentMBS a

MsgBox "const: "+c+" "+Str(Len(c))+EndOfLine+"allocated: "+a+" "+Str(Len(a))
Overwrites content of string with zeros.
We check if this is a constant string and for those do nothing.
Returns true if we zeroed content, otherwise false.

This function can help to clear memory for passwords stored in strings.

Blog Entries

Feedback, Comments & Corrections

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

The biggest plugin in space...

MBS Xojo Plugins