generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

manipulating string

Previous Thread :: Next Thread 
SpecterSlash is not online. SpecterSlash
Joined: 29 Aug 2009
Total Posts: 629
23 Aug 2014 05:12 AM
Im making a game that uses lots of string (the part's name is used)

basically, i need help editing string values for example,

text1 = "Plint_Fire"
--i need to find out if its a plint.
text:match("Plint_")
--now i need to remove the part that says "Plint_" so that only "Fire" will be left in the string

the new string should be = "Fire"

---------
another example:
text1 = "[S]SpecialEvent"
check if match ("[S]")
remove "[S]" from string
newstring = "SpecialEvent"
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
23 Aug 2014 05:43 AM
text1 = "Plint_Fire"
--i need to find out if its a plint.
if string.sub(text1, 1, 6) == "Plint_" then
--now i need to remove the part that says "Plint_" so that only "Fire" will be left in the string
text1 = "Fire"
end
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
23 Aug 2014 05:43 AM
But if you are declaring text1 as Plint_Fire then the condition will always be true, just be aware of that.
Report Abuse
IcyFires is not online. IcyFires
Joined: 29 Jun 2013
Total Posts: 5046
23 Aug 2014 05:45 AM
Oh and if you want the second part to be flexible for renaming put:

text1 = string.sub(text1, 7)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image