DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Re: How to use Replace() function?Thank you

  1. #1
    Bassel Tabbah Guest

    Re: How to use Replace() function?Thank you


    "Steve Gomori" <sgomori@no.spam.yahoo.com> wrote:
    >Couldn't you add a Priority column to the table, and have the Select do

    an
    >Order By on that column? Then you do have control over the sequence of
    >operations.
    >
    >>
    >> Thank you Russ very much. The problem is that I do not have control over
    >> the sequence of operations, since my find and replace strings are stored
    >> in a database and the process is automated. The table in the database

    is
    >> sorted descendingly to help with what you suggested, however, this did

    not
    >> help much.I don't know if the solution lies in creating any array of

    >smaller
    >> and bigger "find" strings, and to have the function skip smaller strings
    >> and replace bigger ones first. The whole thing is complicated and above

    my
    >> head and beyond my abilities. Thank you very much for your reply.

    >
    >

    Steve, thank you very much for the tip. It is quite an interesting technique.
    I am going to pursue this solution and see what happens. Thanks a lot.

  2. #2
    Bassel Tabbah Guest

    Re: How to use Replace() function?Thank you


    "Michael Cole" <mc@mercsys.com.au> wrote:
    >
    >"Bassel Tabbah" <tabbah@un.org> wrote in message
    >news:3b782ce6$1@news.devx.com...
    >>
    >> I use the Replace() function quite often in my work. But I have the

    >following
    >> problem: suppose I have this text:
    >>
    >> "The US Government is asking the US Department of State" in a TextBox,

    and
    >> in my replacement file I have:
    >>
    >> Find: "US", Replace with: "United States";
    >>
    >> Find: "Department of State", Replace with:"Department of Commerce";
    >>
    >> Find: "The US Department of State", Replace with:"The US Department of

    >Defence".
    >>
    >> Now when the Replace() function replaces "US" first, it will no longer

    be
    >> able to find the rest of the replacement strings, since the text will

    have
    >> become:
    >> "The United States Department of State", and so on.
    >>
    >> Is there a function "out there" that will replace bigger strings, "whole
    >> sentences"' first and then go down to smaller and smaller ones? I do not
    >> know if this is possible or not. Definitely I am not able to write such

    a
    >> function. Can you help? Thank you very much for your time.

    >
    >A /non_perfect/ solution is to each search/replace on the text AND on all
    >following s/r strings, so that on performing the "US" replace, the s/r
    >string of "The US Department of State" would become "The United States
    >Department of State".
    >
    >This would definitely help, but would NOT produce a perfect result.
    >
    >
    >Thank you very much. I don't understand the part in your reply where you

    say "is to each search/replace". Could please explain?
    >



  3. #3
    Michael Cole Guest

    Re: How to use Replace() function?Thank you


    "Bassel Tabbah" <tabbah@un.org> wrote in message
    news:3b7a8111$1@news.devx.com...
    >
    > "Michael Cole" <mc@mercsys.com.au> wrote:
    > >
    > >"Bassel Tabbah" <tabbah@un.org> wrote in message
    > >news:3b782ce6$1@news.devx.com...
    > >>
    > >> I use the Replace() function quite often in my work. But I have the

    > >following
    > >> problem: suppose I have this text:
    > >>
    > >> "The US Government is asking the US Department of State" in a TextBox,

    > and
    > >> in my replacement file I have:
    > >>
    > >> Find: "US", Replace with: "United States";
    > >>
    > >> Find: "Department of State", Replace with:"Department of Commerce";
    > >>
    > >> Find: "The US Department of State", Replace with:"The US Department of

    > >Defence".
    > >>
    > >> Now when the Replace() function replaces "US" first, it will no longer

    > be
    > >> able to find the rest of the replacement strings, since the text will

    > have
    > >> become:
    > >> "The United States Department of State", and so on.
    > >>
    > >> Is there a function "out there" that will replace bigger strings,

    "whole
    > >> sentences"' first and then go down to smaller and smaller ones? I do

    not
    > >> know if this is possible or not. Definitely I am not able to write such

    > a
    > >> function. Can you help? Thank you very much for your time.

    > >
    > >A /non_perfect/ solution is to each search/replace on the text AND on all
    > >following s/r strings, so that on performing the "US" replace, the s/r
    > >string of "The US Department of State" would become "The United States
    > >Department of State".
    > >
    > >This would definitely help, but would NOT produce a perfect result.
    > >
    > >
    > >Thank you very much. I don't understand the part in your reply where you

    > say "is to each search/replace". Could please explain?


    Apologies. Insert the word, "perform" between "to" and "each".

    HTH


    --
    Michael D. Cole



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center