# This constant uses a compiler method to initialize its value.
data<string> const StartupName = CompilerStrUprLwrRange("abCdhJuiREew",'P','o')
# This method is used at compile-time to return a modified version of the string (upr/lwr within range).
public compiler method<string> CompilerStrUprLwrRange(string Text, string LowChar, string HighChar)
{
data<int> Length
data<int> Index = 1
data<string> TmpChar
data<string> RetStr = Text
#-----------------------------------------------------------------------------------
# Loop through the entire length and check original string using 'while' statement
# and one method of testing for the character being within a range. This logic
# converts upper case and "in range" characters (in original string) to upper case.
#-----------------------------------------------------------------------------------
Length = CompilerStrLen(Text)
while ( Index <= Length )
{
# Get the character at this position and determine if it should be changed.
TmpChar = CompilerStrSub(Text,Index,1)
# If upper case and in range, flip the case and overlay it back into the string.
if ( (TmpChar >= LowChar & TmpChar <= HighChar) & (TmpChar in 'A'..'Z') )
{
RetStr = CompilerStrOvr(RetStr,CompilerStrLwr(TmpChar),Index)
}
CompilerInc(@Index)
}
#------------------------------------------------------------------------------------
# Loop through the entire length and check original string using 'until' statement
# and 'in' keyword for testing a character within a range. This logic converts
# lower case and "in range" characters (in original string) to upper case.
#------------------------------------------------------------------------------------
Index = 1
until ( Index > Length )
{
# Get the character at this position and determine if it should be changed.
TmpChar = CompilerStrSub(Text,Index,1)
# If lower case and in range, flip the case and overlay it back into the string.
if ( (TmpChar >= LowChar & TmpChar <= HighChar) & (TmpChar in 'a'..'z') )
{
RetStr = CompilerStrOvr(RetStr,CompilerStrUpr(TmpChar),Index)
}
CompilerInc(@Index)
}
return(RetStr)
}
# This class is used to startup the script.
public class Main from<Thread>
{
public method Main()
{
Thread() # Must invoke base constructor.
}
public virtual method Run
{
data<int> Index = 1
data<string> TmpChar
data<string> Name = StartupName
#------------------------------------------------------
# Use the 'while' statement to change each character.
#------------------------------------------------------
while ( Index <= Name.Len() )
{
# Get the character and modify it based on lower case vs upper case.
TmpChar = Name.Sub(Index,1)
if ( TmpChar in 'A'..'Z' )
{
# Increase character by one and write it back into the string.
Name.Ovr(TmpChar.Inc(),Index)
}
else if ( TmpChar in 'a'..'z' )
{
# Decrease character by one and write it back into the string.
Name.Ovr(Char(TmpChar.Ascii() - 1),Index)
}
Index.Inc()
}
Script().WriteLog("And the name is... " + Name)
return
}
}