Blockland Forums
Home
Help
Login
Register
Blockland Forums
»
Blockland Forums
»
Modification Help
»
Trimming Text
« previous
next »
Print
Pages: [
1
]
Author
Topic: Trimming Text (Read 705 times)
Gordo12699
April 01, 2013, 01:17:34 AM
Is there some sort of function to trim the text out of a string? For example, I want to use the string of an item icon, but I want to get rid of the png. Icon = base/client/ui/icons/ItemIcon
.png
How would I get rid of the.png part?
Ad Bot
Advertisement
Greek2me
April 01, 2013, 01:20:43 AM
This is a useful resource:
http://docs.garagegames.com/tge/official/content/documentation/Reference/Console%20Functions/TorqueScript_Console_Functions_7.html
Anyway, your code would look like this:
Code:
[Select]
%file = "base/client/ui/icons/ItemIcon.png";
%icon = filePath(%file) @ "/" @ fileBase(%file);
Lugnut
April 01, 2013, 01:21:22 AM
try
strReplace()
I'm rusty enough on torquescript to not remember the syntax, but i think the arguments are
text to find, text to replace with, string to search in
Or use greek2me's option if the string is always a file path.
Greek2me
April 01, 2013, 01:23:32 AM
Yes, my code assumes that it's a file path.
Gordo12699
April 01, 2013, 02:39:25 AM
I love you greek
Print
Pages: [
1
]
« previous
next »
Blockland Forums
»
Blockland Forums
»
Modification Help
»
Trimming Text