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
 

Subtracting from a string?

Previous Thread :: Next Thread 
stickmanx25 is not online. stickmanx25
Joined: 17 Aug 2007
Total Posts: 5829
23 May 2014 09:25 AM
I'm trying to run a method that subtracts characters from the end of a string. For example, if I were to subtract 5 characters,

"I like pie verily so"
becomes
"I like pie veri"

Is there any method to doing this?
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
23 May 2014 09:26 AM
Use string.sub
http://wiki.roblox.com/index.php?title=String_manipulation#string.sub

-[::ƧѡÎḾḠΰῩ::]-[::Helper of Scripting and Writer of Wikis::]
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
23 May 2014 10:18 AM
function subString(str, amount)
if str:len() < amount then return "" end
return str:sub(1,str:len()-amount)
end

subString("Hello", 3)
>>He
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