steva
asked on
Manipulating VB strings in ASPX
Could someone point me to some string manipulation routines in VB? I've picked up a string variable with the following code in Page_Load:
Public reason As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
reason = Request.Form("Reason")
End Sub
The full text for "Reason" , though, is
DECLINED:1101610001:Invali d account number
and I'd like to modify this to eliminate everything in front of the ":" and use it in my HTML code with an embedded code block:
Transaction <%=reason %>
so the page reads
Transaction: invalid account number
Thanks for any ideas.
steva
Public reason As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
reason = Request.Form("Reason")
End Sub
The full text for "Reason" , though, is
DECLINED:1101610001:Invali
and I'd like to modify this to eliminate everything in front of the ":" and use it in my HTML code with an embedded code block:
Transaction <%=reason %>
so the page reads
Transaction: invalid account number
Thanks for any ideas.
steva
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Dim i As String = "DECLINED:1101610001:Inval id account number"
Dim pattern As String = ".*:(?<code>.*)"
Response.Write(Regex.Match (i, pattern).Groups("code").Va lue)
Dim pattern As String = ".*:(?<code>.*)"
Response.Write(Regex.Match
ASKER
Thanks.
steva