473,847 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Replace method of String object doesn't work

It looks like the String.replace doesn't work in IE6.1. Anyone else
has the same problem. I am using newest service package of IE and
Win2K.

Thanks
Jul 20 '05 #1
1 16350
Thomas wrote:
It looks like the String.replace doesn't work in IE6.1. Anyone else
has the same problem. I am using newest service package of IE and
Win2K.

Thanks


There are a number of issues going on here.

One, there is no such thing as IE 6.1, the latest version of IE is 6.0
Service Pack 1.

Two, just because you are running IE 6.0SP1 does not guarantee that you
are running JScript 5.6, the way to verify this is to go to:

Start -> Run -> type "cmd", hit Enter
type "cscript", hit Enter
You should see something similar to "Microsoft (R) Windows Script Host
Version 5.6", the number you see there is the version of JScript you are
using. If it's anything other then 5.6, check <url:
http://msdn.microsoft.com/library/en...nformation.asp
/> to see if String.replace( ) is a supported method for your version of
JScript (hint: replace() has been a method of the String object since
JScript 1.0).

Three, alert("My String".replace (/String$/, "New String")); works just
fine.

Four, note that String objects are immutable, that is, you don't modify
the original String when you call replace(), but instead a new String
object is returned that contains the replaced String.

var s = "My String";
s.replace(/String$/, "New String");
alert(s);
// alerts "My String"

var s = "My String";
s = s.replace(/String$/, "New String");
alert(s);
// alerts "My New String"

In the future, instead of simply stating that some method doesn't work,
perhaps you could include the simplest example of your code that
exhibits the incorrect behaviour. Often the very act of simplifying your
code to demostrate the problem reveals the cause of the problem.

--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6728
by: gipsy boy | last post by:
// -- using namespace std; map<string,string> formMap; list<string> formParams; for(list<string>::iterator fit = formParams.begin(); fit!=formParams.end(); fit++) { cout << "key=" << *fit; formMap.insert(make_pair(*fit,*(++fit)));
0
1263
by: Tim Shih | last post by:
Hi, I am implementing a server/client application using remoting. The server communicates with the client by having the client pass an object over to the server when it logs in. The object implements an interface which is shared among both the server and the client. This approach worked fine when debugging within visual studio. However, when I deploy the client as an executable, the server can no longer access the object which the client...
3
11079
by: Steph. | last post by:
Hi, String.Insert doesn't seems to work.... (see example below) Could someone explain me this ? : private void button1_Click(object sender, System.EventArgs e) { string tmp="12345678901234567890"; string toinsert="HELLO"; tmp.Insert(10,toinsert); MessageBox.Show(tmp);
1
1351
by: Zeng | last post by:
I looked at the watch window in the debugger CurrentThread.Name shows "" as its value. Documentation shows that == operator of a string would test for value. So does anyone know why this test evaluated to false? Thanks! ( "" == System.Threading.Thread.CurrentThread.Name )
0
1035
by: m m via DotNetMonster.com | last post by:
my code as folllows; TType TypeHere = typeof(CIODMLib.CatAdmClass); object ObjectHere = admNew.GetCatalogByName(strName); object Wrapper = Marshal.CreateWrapperOfType(ObjectHere, TypeHere); catNew = (CIODMLib.CatAdmClass)Wrapper; //OK untill this catNew.AddScope(strScope,fExclude,vLogOn,vPassword);//Error here But it gives an error when I pass correct parameters for Add scope as follows
2
1013
by: Peter Afonin | last post by:
Hello, I've installed Windows XP SP2 on my development PC. After this any session object in my applications doesn't work anymore. Whatever I put into my session object, when I debug I can see that it has no value. When I upload my application to the server - everything works OK. This started immediately after I installed this patch. Do you know how to fix it?
2
3675
by: Keith Patrick | last post by:
Maybe my expectations are just too low because I haven't read much documentation on this method, but basically, I am trying to load a user control dynamically without using a virtual path (I have disabled FileIOPermission beyond AllLocalFiles, and it appears that LoadControl(string) calls Server.MapPath, which needs greater access). What I am attempting to do is just pass in my UC type: Control ctrl =...
5
6951
by: mbosco51 | last post by:
Hi. I have a virtual path setup in order to give my web server access to a file on my app server. I am using the file system object to check for the existance of the file and if it exists, it has to validate the file date. The problem is I can't seem to find the file. I can successfully check for the existance of a file on the web server, but once I enter the virtual path it can't find anything. All three of these calls return...
5
3778
by: UJ | last post by:
I have a program that uses the Shockwave Flash Objects (ShockwaveFlashObjects) to display a SWF. Everything works fine. When IE7 is installed on the machine, suddenly we get an 'Invalid char line 2, char 1' error on the SWF file. If we load the SWF file in IE it works fine. If we uninstall IE7 and go back to 6, it works fine. Any thoughts? TIA - Jeff.
0
9882
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9727
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10982
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10335
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5719
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4524
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4116
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3160
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.