String Formatting?


#1

Is there a way to format a string? For instance, I’d like to include or exclude the last 4 characters of a 5 character string. While I am here, can I change the string to all upper case or lower case lettering?

Thank you,
-Troy


Update:

Here are the links:
www.liquidfaith.com/tgusler/files/Vlk/StringFormat/StringFormat%20-%2020190214_2.exe
www.liquidfaith.com/tgusler/files/Vlk/StringFormat/StringFormat%20-%2020190214_2.vpk
www.liquidfaith.com/tgusler/files/Vlk/StringFormat/StringFormat%20-%2020190214_2.zip

Here is what it looks like:


#2

Yes, the expressions has a set of functions to manipulate strings. See below:

// Number of character in a string
StrLen(aText) -> Int
// Return a slice of a string from the start index to the end index. If end index is negative it is understood to be relative to the end of the string (so -2 is the second last character).
StrSlice(aText, aStartIndex, aEndIndex: optional) -> String
// Return aCount characters of a string starting at aStartIndex
StrMid(aText, aStartIndex, aCount) -> String
// Return aCount characters at the begining of the string.
StrLeft(aText, aCount) -> String
// Return aCount characters at the end of the string.
StrRight(aText, aCount) -> String
// Return the text before the specified substring. An empty string if the substring is not found.
StrBefore(aText, aSub) -> String
// Return the text before the specified substring, starts looking for the substring from the end. An empty string if the substring is not found.
StrRBefore(aText, aSub) -> String
// Return the text after the specified substring. An empty string if the substring is not found.
StrAfter(aText, aSub) -> String
// Return the text after the specified substring, starts looking for the substring from the end. An empty string if the substring is not found.
StrRAfter(aText, aSub) -> String
// Convert the text to lowercase
StrToLower(aText) -> String
// Convert the text to uppercase
StrToUpper(aText) -> String
// Removes all spaces at the begining and end of the text.
StrTrim(aText) -> String
// Removes all spaces at the begining and end of the text and all duplicated spaces. So "  Hello   Narf !" becomes "Hello Narf !".
StrNormalize(aText) -> String

#3

Thanks for all of the help!
I’ve made a test level and saved it out so anyone can experiment with it and see it working.

Here are the links:
www.liquidfaith.com/tgusler/files/Vlk/StringFormat/StringFormat%20-%2020190214_2.exe
www.liquidfaith.com/tgusler/files/Vlk/StringFormat/StringFormat%20-%2020190214_2.vpk
www.liquidfaith.com/tgusler/files/Vlk/StringFormat/StringFormat%20-%2020190214_2.zip

Here is what it looks like:

Edit:
The zip file is the Valkyrie project. You can load the level and see how it works. There are a couple comments available to explain what is going on.