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: Checking spaces in string.

Previous Thread :: Next Thread 
CaptainSource is not online. CaptainSource
Joined: 08 Jun 2013
Total Posts: 848
20 Jun 2015 05:49 AM
local text = [[



]];

local k = 0;

for i in text:gmatch("%s+") do
k = k + 1;
end;

print(k); -- it returns 1
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
20 Jun 2015 05:55 AM
There's no text in it...

Try this out:

local text = [[ ]]

local s = 0

for a in text:gmatch("%s+") do
s = s + 1
end

print(s)
Report Abuse
CaptainSource is not online. CaptainSource
Joined: 08 Jun 2013
Total Posts: 848
20 Jun 2015 05:56 AM
but need mine e.e
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
20 Jun 2015 05:57 AM
You don't have any spaces in yours. You just pressed enter a couple times.
Report Abuse
CaptainSource is not online. CaptainSource
Joined: 08 Jun 2013
Total Posts: 848
20 Jun 2015 05:58 AM
this text is going to be textbox with multiple lines will it work ther ?
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
20 Jun 2015 05:59 AM
probably
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
20 Jun 2015 06:14 AM
\n and whitespaces are two different things my friend.
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
20 Jun 2015 06:22 AM

This one is an easy one.

Use...

str:gmatch("[^/n/r]+")
Report Abuse
CaptainSource is not online. CaptainSource
Joined: 08 Jun 2013
Total Posts: 848
20 Jun 2015 06:28 AM
what is "^" means ?
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
20 Jun 2015 06:29 AM
checks from the beginning of a string
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
20 Jun 2015 06:37 AM
I'm pretty sure when it's used in a set, it means "Not containing"
http://wiki.roblox.com/index.php?title=String_pattern#Complements
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
20 Jun 2015 07:27 AM
"[^\n\r]+" *
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
20 Jun 2015 08:00 AM
@eLune
I write in java and am constantly changing paths from \ to / :)
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
20 Jun 2015 11:17 AM
The escape is still \n and \r in Java.
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