codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  HELP WITH STRINGS :(  mike31 at 22:05 on Tuesday, April 19, 2005
 

We have to create a program that first, accepts a string from the user (up to 80 words, then, it acts the user the choose which word they want to replace in that string, and finally, they have to write in the string to REPLACE IT WITH.

I need the return method.

return (str,str,str)

HELP PLESE :(

  Re: HELP WITH STRINGS :(  kanad at 13:25 on Thursday, April 21, 2005
 

Hello mike31
Try this code

<HTML>
<HEAD>
<TITLE>String Replace Code</TITLE>
<script type="text/javascript">
var retStr=new Array(3);

function replace(string,text,by)
{
var myString=string;
while(myString.indexOf(text)!=-1)
{
myString=myString.replace(text,by);
}
retStr[0]=myString;
retStr[1]=text;
retStr[2]=by;
return retStr;
}
var strMsg='You want to Replace XX with AB in string ABCDAB';
strMsg=strMsg+'\nYou can use replace("ABCDAB","AB","XX")';
strMsg=strMsg+"You get Value "+replace("ABCDAB","AB","XX");
strMsg=strMsg+"\nYour Replaced String "+replace("ABCDAB","AB","XX")[0];
document.write(strMsg);


</script>

</HEAD>
<BODY>



</BODY>
</HTML>









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: email with image
•  Re: Windows Authentication using LDAP get user first name
•  Two dimentional array - Dropdown box
•  Mcrypt problem
•  datagrid - paging - print data from particular page
•  How to reorder or Re arrange the node in XSL Using ASP and VBScript
•  Multiple rows from form into XML?
•  Dhtml menu, submenu losing focus. I`m so close!
•  Re: CLICK ON ROW AND CHECK The CHECKBOX


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005