Advertisement Jump to content
Sign in to follow this  

String visual basic

This topic is 4970 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Guest Anonymous Poster
The efficient way in VB is to check its length:

If Len(myString) Then myString has data.

This is converse to most other languages. Most languages use null terminated strings and as such would have to scan the string to find the null in order to determine its length. Thus, in other languages you would instead simply check if the first character is a null.

In VB, strings are complex. The token used to reference a string is a reference to a string descriptor which, among other things, holds the length of the string and a pointer to the actual string data. So checking its length happens to be very efficient (on par with peeking at the first character of a string in other languages), while comparing the string to "" wouldnt necessarily be.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!