 |
 |
| Domino Tips: |
|
 |
 |

LOTUSSCRIPT
Ultimate Replacesubstring Function
Scott Bockelman  10.19.1999
Rating: --- (out of 5)




A lot of people are posting LotusScript versions of @ReplaceSubstring. Here's my favorite: Function ReplaceSubstring(sSource As String, sFrom As String, sTo As String) As String Dim sResult As String Dim i As Integer, iLenFrom As Integer, iLenRslt As Integer i=0 iLenFrom=Len(sFrom) sResult=sSource Do While(i < Len(sResult)) i=i+1 If Mid$(sResult, i, iLenFrom ) = sFrom Then iLenRslt=Len(sResult) sResult=Left$(sResult, (i-1)) + sTo + Right$(sResult, iLenRslt - ( (i-1) + ( iLenFrom ) ) ) End If Loop ReplaceSubstring=sResult End Function
Code
Function ReplaceSubstring(sSource As String, sFrom As String, sTo As String) As String Dim sResult As String Dim i As Integer, iLenFrom As Integer, iLenRslt As Integer i=0 iLenFrom=Len(sFrom) sResult=sSource Do While(i < Len(sResult)) i=i+1 If Mid$(sResult, i, iLenFrom ) = sFrom Then iLenRslt=Len(sResult) sResult=Left$(sResult, (i-1)) + sTo + Right$(sResult, iLenRslt - ( (i-1) + ( iLenFrom ) ) ) End If Loop ReplaceSubstring=sResult End Function
 |

|
Rate this Tip
|
To rate tips, you must be a member of SearchDomino.com. Register now
to start rating these tips. Log in if you are already a member.
|


');
// -->
DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.
|
 |
|
|
 |
|
 |
 |
 |
 |
| TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of . |
|
| |
All Rights Reserved, , TechTarget |
|
|
|
|
|