|
|
|
ขอโค้ด c# การตัด string ด้วยค่ะ ตอนนี้ทำโปรเจคเกี่ยวกับการแปลงภาษาช่วยด้วยนะค่ะ |
|
|
|
|
|
|
|
Code (C#)
<%@ Page Language="C#" %>
<script runat="server">
void Page_Load(Object sender, EventArgs e)
{
String strString = "I Love ThaiCreate.Com Version 2009";
this.lblText1.Text = strString.Substring(7,14);
this.lblText2.Text = Left(strString,6);
this.lblText3.Text = Right(strString,4);
this.lblText4.Text = Mid(strString,7,14);
this.lblText5.Text = Mid(strString,6);
}
public String Left(String Param, int Length)
{
String Result = Param.Substring(0, Length);
return Result;
}
public String Right(String Param, int Length)
{
String Result = Param.Substring(Param.Length - Length, Length);
return Result;
}
public String Mid(String Param,int StartIndex, int Length)
{
String Result = Param.Substring(StartIndex, Length);
return Result;
}
public String Mid(String Param,int StartIndex)
{
String Result = Param.Substring(StartIndex);
return Result;
}
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Label id="lblText1" runat="server"></asp:Label><br />
<asp:Label id="lblText2" runat="server"></asp:Label><br />
<asp:Label id="lblText3" runat="server"></asp:Label><br />
<asp:Label id="lblText4" runat="server"></asp:Label><br />
<asp:Label id="lblText5" runat="server"></asp:Label><br />
</form>
</body>
</html>
|
|
|
|
|
Date :
2010-07-15 17:36:05 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|