LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Fast string replacement

I have the following sample string:
(My actual strings are much longer than this)

s = "You must eat lots of fruits and vegetables every day
in the daytime hours."

I'm looking for a fast way to replace an entire set of words
in the above string as follows:

"must" - "should"
"fruits" - "eggs"
"vegetables" - "bacon"
"day" - "morning"

The final output should be:

"You should eat lots of eggs and bacon every morning
in the daytime hours."

The string replacements must occur on word boundaries
only. So, if "daytime" occurs in the string, then I do not
want to change that to "morningtime".

The faster the solution, the better. Would a regular
expression approach be faster than using a "for-each"
construct with a bunch of boolean logic and Instr() calls?





 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fast way to truncate string Robert Crandal[_3_] Excel Programming 30 April 1st 15 11:43 PM
DDE Replacement? Mark Excel Programming 1 September 10th 06 05:30 AM
Replacement T De Villiers[_49_] Excel Programming 3 July 21st 06 08:18 PM
Replacement mowen Excel Discussion (Misc queries) 1 September 7th 05 09:01 PM
Any fast method to parse a string into row & col information Nick Excel Programming 3 August 19th 04 06:47 PM


All times are GMT +1. The time now is 04:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"