IsNumeric, IsDate, IsNothing : String Functions « Data Type « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » Data Type » String Functions 
2.38.3.IsNumeric, IsDate, IsNothing
Public Class Tester
    Public Shared Sub Main
        Dim theData As String = Nothing
        Dim result As New System.Text.StringBuilder

        ' ----- Format nothing.
        result.AppendLine(String.Format_
           "IsNumeric({0}) ... {1}", theData, IsNumeric(theData)))
        result.AppendLine(String.Format_
           "IsDate({0}) ... {1}", theData, IsDate(theData)))
        result.AppendLine(String.Format_
           "IsNothing({0}) ... {1}", theData, IsNothing(theData)))
        result.AppendLine()

        ' ----- Format a number in a string.
        theData = "-12.345"
        result.AppendLine(String.Format_
           "IsNumeric({0}) ... {1}", theData, IsNumeric(theData)))
        result.AppendLine(String.Format_
           "IsDate({0}) ... {1}", theData, IsDate(theData)))
        result.AppendLine(String.Format_
           "IsNothing({0}) ... {1}", theData, IsNothing(theData)))
        result.AppendLine()

        ' ----- Format a date in a string.
        theData = "July 17, 2007"
        result.AppendLine(String.Format_
           "IsNumeric({0}) ... {1}", theData, IsNumeric(theData)))
        result.AppendLine(String.Format_
           "IsDate({0}) ... {1}", theData, IsDate(theData)))
        result.Append(String.Format_
           "IsNothing({0}) ... {1}", theData, IsNothing(theData)))

        Console.WriteLine(result.ToString())

    End Sub
End Class
IsNumeric() ... False
IsDate() ... False
IsNothing() ... True

IsNumeric(-12.345) ... True
IsDate(-12.345) ... False
IsNothing(-12.345) ... False

IsNumeric(July 17, 2007) ... False
IsDate(July 17, 2007) ... True
IsNothing(July 17, 2007) ... False
2.38.String Functions
2.38.1.Passing String values to Val
2.38.2.Passing formatted numeric values to Val
2.38.3.IsNumeric, IsDate, IsNothing
2.38.4.Duplicate a string
2.38.5.Get string index by using InStr
2.38.6.CStr: Convert Double to String
2.38.7.Len: get string length
2.38.8.Instr
2.38.9.IsDBNull
2.38.10.Microsoft.VisualBasic.Left
2.38.11.String.Copy
2.38.12.Use String.Concat to concatenate two strings
2.38.13.Format: c
2.38.14.String handling function: Len
2.38.15.Left: get characters from left
2.38.16.Right: get characters from right
2.38.17.Mid(string, 4, 5): get sub string from middle
2.38.18.Mid(string, 7): get sub string from start
2.38.19.Instr: find character in a string
2.38.20.Instr: find sub string a in a string
2.38.21.LCase: change string to lower case
2.38.22.UCase: change string to upper case
2.38.23.Change string case using the English-United States and Turkish-Turkey cultures and then compare
2.38.24.Determines whether a string is normalized to various normalization forms(String.Normalize and the String.IsNormalized method)
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.