[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ASP.NET/VB: Trim quotation marks from beginning and end

Posted on 2011-09-06
7
Medium Priority
?
501 Views
Last Modified: 2012-05-12
Using ASP.NET/VB, I would like to trim quotation marks from the beginning and end.

These charactors should be REMOVED if they are the first or last character of the Headline.

"“”
<h2><%#Container.DataItem("Headline")%></h2>

Open in new window

0
Comment
Question by:hankknight
  • 4
  • 2
7 Comments
 
LVL 28

Accepted Solution

by:
strickdd earned 2000 total points
ID: 36490709
code infront:

 <h2><% FormatTitle(Container.DataItem("Headline"))%></h2>

code behind:

protected function FormatTitle(title As Object) As String
    Dim temp as String
    Dim originalString As String = title.ToString()

    if originalString.StartsWith(""") then
        temp = originalString.SubString(1)
    else
        temp = originalString
    end if

     if temp.EndsWith(""") then
         temp = temp.SubString(0, temp.Length - 1)
    end if

   return temp

end fuction
0
 
LVL 16

Expert Comment

by:disrupt
ID: 36490942
0
 
LVL 16

Author Comment

by:hankknight
ID: 36490980
Thanks.  disrupt, this needs to be VB not C#.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 16

Expert Comment

by:disrupt
ID: 36490981
"TrimStart and TrimEnd are supposed to take a character array as a parameter. If you type the keyword null instead, it will trim the white space (blank characters)."

you can also just do this:

returnValue.TrimStart( '" ', '“','”' );
returnValue.TrimEnd( '" ', '“','”' );
0
 
LVL 16

Expert Comment

by:disrupt
ID: 36490993
It will work in vb .net fine just leave out the semicolon at the end :)
0
 
LVL 16

Author Comment

by:hankknight
ID: 36491145
Thanks, disrupt.   I awarded the points just moments before you made your post.

strickdd, you solution works.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Screencast - Getting to Know the Pipeline
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month19 days, 14 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question