Friday, May 8, 2009

LotusScript: Case insensitive replace

Recently, I've been working on "cloning" CMS-type applications. To avoid a lot of unnecessary work, I run an agent on the copied CMS that rewrites the UNID of the documents to that of the document in the original CMS, and rewrites local links to point to the cloned application.

Since the urls can be typed in multiple ways, the way to go for the link rewriting is case insensitive replace. This is provided in LotusScript (no need for Java).
Replace( htmlBody, webDbNameSource, webDbNameClone, , , 1 )

The last parameter tells replace that it should do a case insensitive replace.

All the parameters (taken from the documentation)
0 (default): case sensitive, pitch sensitive
1: case insensitive, pitch sensitive
4: case sensitive, pitch insensitive
5: case insensitive, pitch insensitive

Example of pitch difference: e, é, è

The CMS applications in question are web applications, so the body is text/HTML. If you're working on cross platform (Notes/Web) applications, I'd think there would be more work to clone an app (RT-navigation *shudders*).

0 comments: