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 » Scripters
Home Search
 

Re: Detecting Word from String

Previous Thread :: Next Thread 
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
23 Oct 2015 09:35 PM
If I wanted to get the word from 'Tip69' without the '69' part, can that be possible?
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
23 Oct 2015 09:39 PM
b1
Report Abuse
iwishforpie1 is not online. iwishforpie1
Joined: 20 Mar 2011
Total Posts: 1423
23 Oct 2015 09:41 PM
Yes. (via : http://wiki.roblox.com/index.php?title=Function_dump/String_manipulation - String.sub)

You can use (string).sub to get what you want.

ex:

local word = TipNumberPootis

word:sub(1,5) will return 1-5 (TipNu)
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
23 Oct 2015 09:43 PM
I need something more exact. I want to get exactly tip, and make sure it's getting the tip nothing else.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Oct 2015 09:46 PM
If you want only alphabetical words, do this.

for Word in string.gmatch(YourString, "%a+") do
-- Do something with Word
end
Report Abuse
REAPERMOXXY is not online. REAPERMOXXY
Joined: 23 Jan 2014
Total Posts: 1831
23 Oct 2015 09:47 PM
are we still talking about scripting here?

True loyalty never dies.
Report Abuse
iwishforpie1 is not online. iwishforpie1
Joined: 20 Mar 2011
Total Posts: 1423
23 Oct 2015 09:48 PM
Yes, that's what sub does.

local word = "AHHHHHHH Tip AHHHHHHH" -- phrase to look in
local find = "Tip" -- the word you want to find
local wordfind = 3 -- how many letters there are in it

local found = false
local stringnumb = 0
repeat

stringnumb = stringnumb + 1
if word:sub(stringnumb,stringnumb+wordfind-1) == find then
found = true
end

until found == true
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
23 Oct 2015 09:48 PM
I just want to breakdown the string 'Tip69' to just 'Tip'.
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
23 Oct 2015 09:50 PM
What If there are multiple words like 'Tip', 'Bob', Joe'. I would scan all of them, and I want it to just scan 'Tip'.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
23 Oct 2015 09:53 PM
So ONLY find Tip?

local Matched = string.match(SomeString, "Tip")
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
23 Oct 2015 09:56 PM
What is the 'SomeString' part suppose to indicate?
Report Abuse
REAPERMOXXY is not online. REAPERMOXXY
Joined: 23 Jan 2014
Total Posts: 1831
23 Oct 2015 09:57 PM
The string you are searching

True loyalty never dies.
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
23 Oct 2015 10:00 PM
But the string I'm searching for is 'Tip', and it's already there? 'SomeString, "Tip"'. It's confusing/bugging me.
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
23 Oct 2015 10:03 PM
I just realized what It mean't, my bad, and thanks. I'll try this out.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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