Jump to content
  • Advertisement
Sign in to follow this  
Satan666

String visual basic

This topic is 4811 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

Advertisement
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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!