replace function

Results 1 to 2 of 2

Thread: replace function

  1. #1
    lefop Guest

    Default replace function

    Hi all.<BR>How can i do this:<BR><BR>string1="03937393039303733"<BR>string 2=ReplaceFunc(string1) <BR><BR>string2 should hold "097909073"<BR> <BR>The replace of "3" with "" must be done in specific parts of the string<BR>(2nd, 4th, 6th,8th etc) character and not in-between<BR>Another example is if string1="03937333333333333" the string2 should be<BR>"097333333&#039;<BR>I hope it make sense.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: replace function

    Looks as if you have a numerical basis for your problem, (2,4,6,8th..) numbers need to be replaced. Since Regular Expressions are text based, using a Regular Expression is not a good solution. You should be looking in regular vbscript doing a division and checking the Mod value of that division. If its &#062; 0 then its an odd number, otherwise if its = 0 then replace it with "" and done.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts