Below is a part of a script I wrote:
Length>PRODUCT,LENGTH
MidStr>PRODUCT,LENGTH,1,CHARACTER
MessageModal>CHARACTER
If>CHARACTER=.
Let>LENGTH=LENGTH-1
MidStr>PRODUCT,1,LENGTH,MOD_PRODUCT
MessageModal>. %MOD_PRODUCT%
EndIf>
The purpose is to eliminate a period from the end of a word.
However, if CHARACTER is 0, the script goes into the IF/EndIf statements and eliminates a 0 from the end of a word. I have other IF/EndIf statements to eliminate other characters; spaces, commas, etc... These other If/EndIf statements work properly.
Any help is greatly appreciated.
IF>CHARACTER=. ERROR
Moderators: Dorian (MJT support), JRL
See this thread
Since 0 and . are numerically equal, you have to treat them as strings.
Since 0 and . are numerically equal, you have to treat them as strings.
Code: Select all
Let>PRODUCT=abcde0
Length>PRODUCT,LENGTH
MidStr>PRODUCT,LENGTH,1,CHARACTER
MessageModal>CHARACTER
//If>CHARACTER=.
//Let>LENGTH=LENGTH-1
//MidStr>PRODUCT,1,LENGTH,MOD_PRODUCT
StringReplace>PRODUCT,.,,MOD_PRODUCT
MessageModal>. %MOD_PRODUCT%
EndIf>
Just occurred to me that you said:
What I posted above will remove ALL periods. Below will only remove the period if it is the last character.The purpose is to eliminate a period from the end of a word
Code: Select all
Let>PRODUCT=.abcde.
Length>PRODUCT,LENGTH
MidStr>PRODUCT,LENGTH,1,CHARACTER
Sub>LENGTH,1
MidStr>PRODUCT,1,LENGTH,MOD_PRODUCT
//MessageModal>CHARACTER
StringReplace>CHARACTER,.,,CHARACTER
ConCat>MOD_PRODUCT,CHARACTER
MessageModal>. %MOD_PRODUCT%