Te envío una función en Lotusscript que viene a hacer lo que el @replacesubstring en fórmulas, no la he hecho yo, pero bueno ahí queda.
Un saludo
Public Function ReplaceSubString(Byval phrase$, Byval oldStr$, Byval newStr$) As String
' This function searches the string passed in phrase for all
' occurences of the string passed in oldStr. It then replaces
' the oldStr with the specified newStr. If an error occurs,
' a NULL value is returned ("").
Const FUNC_NAME= "ReplaceSubString2"
On Error Goto Errors
Dim begin%, found%, oldPhrase$
'---- Make sure that we have a phrase to change, and a string to look for:
If Strcompare(oldStr, "") = 0 Or Strcompare(phrase, "") = 0 Then Goto TheEnd
'---- Save the original string
oldPhrase= phrase
begin = 1
found = Instr(begin, phrase, oldStr, 1)
While (found > 0)
begin = found + Len(newStr)
'---- Changing an instance of oldString
phrase = Left$(phrase, (found - 1)) & newStr & Right$(phrase, Len(phrase) - (found + Len(oldStr) - 1))
'--- Looking for a new instance of oldString
found = Instr(begin, phrase, oldStr, 1)
Wend
'---- Returning the new phrase changed
ReplaceSubString = phrase
TheEnd:
Exit Function
Errors:
'---- Returning the original value of phrase
ReplaceSubString = oldPhrase
Resume TheEnd
End Function
|
Otros documentos de LotusScript
|