Showing posts with label marks. Show all posts
Showing posts with label marks. Show all posts

Monday, March 26, 2012

Strings with quotation marks that cant be accessed

Hello everyone...
I did search for my problem but most hits concerned other problems concering the quotation mark.
My problem is this:
Within a CMS, that allows .NET code to be executed I need to assign a variable to a cms-element. That cms-element contains text.
As long as it just plain text there's no problem. If the element contains an hyperlink for example the variable assignment will not work.
Is there anyway I can alter the cms-element with vb beforehand?
The idea is to remove all html code within the cms-element before the CMS exports the page to PDF...
Accessing and altering the cms-element itself is not possible in my case...
I hope I could explain the problem properly. If not, please ask.
Any hints, workarounds or thoughts will be deeply appreciated!
Philipp
no ideas?Smile [:)]

Saturday, March 24, 2012

Stripping out punctuation marks

Is there an easy way to edit a string so that only alphabetical characters
and numbers are allowed? Thanks for your help.Try this function:

Public Function Removes(ByVal mystring As String) As String

Dim newstring As String

For Each character As Char In mystring

If Not Char.IsPunctuation(character) Then newstring &= character

Next

Return newstring

End Function

This basically loops through the string and tests whether each character is
punctuation. If it is not, it appends it to a new string. You can use the
same technique for the other Is... methods of the Char type. You can also
use the Replace method to replace all instances of a specific character with
a zero-length String as in the following:

mystring.Replace("."c,"")

The lower-case c in the code tells VB.NET to interpret the String as a Char.
Try whichever one of these works best for you, if you need more help feel
free to ask. Good Luck!
--
Nathan Sokalski
njsokalski@.hotmail.com
http://www.nathansokalski.com/

"dew" <dew@.yahoo.com> wrote in message
news:uRzn4W3KGHA.720@.TK2MSFTNGP14.phx.gbl...
> Is there an easy way to edit a string so that only alphabetical characters
> and numbers are allowed? Thanks for your help.

Stripping out punctuation marks

Is there an easy way to edit a string so that only alphabetical characters
and numbers are allowed? Thanks for your help.Try this function:
Public Function Removes(ByVal mystring As String) As String
Dim newstring As String
For Each character As Char In mystring
If Not Char.IsPunctuation(character) Then newstring &= character
Next
Return newstring
End Function
This basically loops through the string and tests whether each character is
punctuation. If it is not, it appends it to a new string. You can use the
same technique for the other Is... methods of the Char type. You can also
use the Replace method to replace all instances of a specific character with
a zero-length String as in the following:
mystring.Replace("."c,"")
The lower-case c in the code tells VB.NET to interpret the String as a Char.
Try whichever one of these works best for you, if you need more help feel
free to ask. Good Luck!
--
Nathan Sokalski
njsokalski@.hotmail.com
http://www.nathansokalski.com/
"dew" <dew@.yahoo.com> wrote in message
news:uRzn4W3KGHA.720@.TK2MSFTNGP14.phx.gbl...
> Is there an easy way to edit a string so that only alphabetical characters
> and numbers are allowed? Thanks for your help.
>