質問

I'm using a long, concatenated String variable and doing a process on that variable. I need to know when the size in memory can become too large, so I need to find the size in memory of that string. Is there a way, and if so how so?

Dim str As String = someLargeAmountOfText
process(str)
役に立ちましたか?

解決

You can use the LenB function to find out how many bytes the string takes up. More information at http://docs.realsoftware.com/index.php/LenB

Dim str As String = someLargeAmountOfText
Dim iLength As UInt64 = str.lenB
If iLength <= somevalue Then
   Process(str)
End If

他のヒント

A MemoryBlock can also be used to get the size of memory used by a String:

Dim s As String = "abcde"
Dim mb As MemoryBlock
mb = s
Dim size As UInt64 = mb.Size
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top