Link to home
Start Free TrialLog in
Avatar of ftacoukj
ftacoukj

asked on

String function returning first x characters

what string function will return first x characters of the string in vb.net?
ASKER CERTIFIED SOLUTION
Avatar of nitrogenx
nitrogenx

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nitrogenx
nitrogenx

thats actually a function of a string object:

Dim x As Int32 = 3
Dim str As String = "I'm a string"
str.SubString(0,x) // I'm
uh thats a C# style comment just ignore after the //
I tested it with the following code:

    Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim x As Int32 = 3
        Dim str As String = "I'm a string"
        Response.Write(str.Substring(0, x))
    End Sub