Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 9th, 2004, 04:41 AM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to PostmanPat
Default ugly result with Replace function

I want to post a message on a site, starting from a simple text template, in which I want to set a little text.

tplText = "<br><table width="100%" border="0" cellspacing="0" cellpadding="5"><tr align="left" valign="top">
<td width="20"><img src="/_images/b_help.gif" width="15" height="14" border="0" align="baseline"></td><td><span class="tekst10pxRood" style="font-size:12px;line-height:16px">[MESSAGE]<br><a href="[LINK]">Meer info</a></span> </td></tr>
</table>"

fillstring = "&é"'(§è!çà)-^$ùµ=:;,1234567890°¨*£%+/.?´`~"
nlstr = tplText.Replace("[MESSAGE]", fillstring);

Result : "&é"'(§è!çà)-^MESSAGENL=[Dit is een NL Test"

i can see that the $ character causes the problem, but I don't know the solution
 
Old August 9th, 2004, 08:33 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What does that text represent? are those unicode characters?

Why are you building so much HTML manually and not using the .NET controls for all of that?

Also, you might try the String.Format() method. Instead of creating your own replacement tokens, you can use the available methods for replaceing inside a string:

strMyString = String.Format("Replace {0} and {1}", "this", "that")
  will result in
strMyString == "Replace this and that"
 
Old August 9th, 2004, 09:13 AM
Registered User
 
Join Date: Aug 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to PostmanPat
Default

I tried using the String.Format function but this also gives
me the same error:

if I put the $ character somewhere in the arguments, the string format doesn't work, you should try it...
 
Old August 11th, 2004, 04:36 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

So, you want us to help you build a system that will automatically post messages for you to web sites--- hmmmmmmm I wonder what use that might have.

Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee





Similar Threads
Thread Thread Starter Forum Replies Last Post
Coalesce and replace function gregalb SQL Server 2000 1 May 15th, 2008 07:59 PM
Extending the Replace Function designdawg Access 9 February 19th, 2008 12:39 PM
replace function keyvanjan Classic ASP Basics 3 May 15th, 2006 12:57 AM
replace function Adam H-W Classic ASP Basics 3 September 20th, 2004 09:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.