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