Home > .NET > Asp.net String properties

Asp.net String properties

Checking string emptiness

Checking the length of the string (if str.length = 0) is faster than (if str = “”) in three times, so off course it is more likely to use.

StringBuilder VS String

String builder is faster than strings when the number concatenations exceeded 3, but if it is less than that than normal string is a little bit faster.

Comparing Strings

Usually we compare strings in the normal way which is (if str1 = str2 then…) but It is faster to compare strings in his way:

Dim str1 As String = “”

   Dim str2 As String = “”

   If str1.Equals(str2) Then

    ‘ here comes your code

   End If

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: