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
 

Re: Know how many numbers or letters on a string has?

Previous Thread :: Next Thread 
rktt is not online. rktt
Joined: 20 Aug 2014
Total Posts: 14
04 Nov 2014 06:20 AM
example:

x="abc123"

then it will say that there are 3 numbers and 3 letters

...


is it even possible?
Report Abuse
ShadowOfCrimson is not online. ShadowOfCrimson
Joined: 14 Dec 2009
Total Posts: 2153
04 Nov 2014 06:46 AM
A lot of things are technically possible, a better question is what is a faster way of doing it other than comparing every character to see if it is a letter or number?
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
04 Nov 2014 07:31 AM
^ a better question is why do you switch the topic, dont you know the answer?

@OP

http://wiki.roblox.com/index.php?title=String_pattern

You'll need string patterns

x = "abc123"

b = string.match(x, "%d")

print(#b)

I MIGHT be wrong, I haven't derusted this side of my scripting yet..
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
04 Nov 2014 07:36 AM
Alright, I tested it now,

its,

x = "abc123"

b = string.match(x, "%d+")

print(#b)

The pattern is

%d = any number
+ = if we dont have this, we wont get more than the first number, to get the whole amount of numbers we must have this


print(AMOUNTb)

AMOUNT = #
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
04 Nov 2014 07:37 AM
http://wiki.roblox.com/index.php?title=String_pattern
http://wiki.roblox.com/index.php?title=Function_dump/String_manipulation

String manipulation for methods which you must use for these stuff
String patterns for what you also must use if you want to do mostly anything with string manipulations.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
04 Nov 2014 07:38 AM
I gotta learn to post in one post,

Also, if you remove the # from print, you will print

>123

the numbers itself, but if yuo want to know how MANY numbers, 1 and 2 and 3 is together 3 numbers, so # (equals amount) is 3.

>3
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