ASP.net
ASP / ASP.Net / Vignette
ASP / ASP.Net / Oracle
Books RSS Feed for ASPMatrix.com Book Reviews
 
 
Partner Sites
www.learnasp.com
 
ASPFriends.com

www.411asp.net

www.wwwcoder.com
 
 
ASP.net > String Class Examples > StartsWith
 
StartsWith Example - Startswith(str)
This will determine whether the beginning of this instance matches the specified String. This is case-sensitive. Will return True or False.
 
String to Parse: "What does this start with?" 
 
Code: startswith("h")
 
 
View the code to do it below.
 
'------------------- begin code ----------------------------

<%@ Page Language="VB" %>
<script runat="server">
const strParse as string = "What does this start with?"

sub page_load(S as Object, e as EventArgs)
     parseme.text = strParse
 end sub

sub Control_Click(S as Object, E as EventArgs)
   
dim sb as new stringbuilder
    dim ss1example as string

    ss1example = strParse.startswith("h")
    sb.append("<b>Results: </b><font color=""#0099FF"">" & ss1example & "</font>")

    results.text=sb.tostring()
end sub
</script>

<html>
...

<form runat="server">
Parse: <I><font color="red">"<asp:literal id="parseme" runat="server" />" </font></I><br />
<asp:Button id="btnSubmit" text="Run Code >>" onclick="Control_Click" runat="server" /><br />
<asp:literal id="results" runat="server" /><br />
</form>

...
</html>

'------------------- end code ----------------------------

 
       
      Please report all site problems to: webmaster@aspmatrix.com