Machsupport Forum

Mach Discussion => Mach Screens => Flash Screens => Topic started by: azambuja on October 15, 2008, 11:06:08 AM

Title: Function to get a number from a string!?
Post by: azambuja on October 15, 2008, 11:06:08 AM
Hello friends!!!

I need to count the numbers of letters of a _root.something (exemple: String="something" to get Number=9, or something like that) and with this number I can use it in a If condition.

Thanks for your supply.

Azambuja
Title: Re: Function to get a number from a string!?
Post by: ger21 on October 15, 2008, 11:31:29 AM
Try:

mystring = "something"
X = LEN(mystring)

X should be 9.

You might be able to just do:

X = LEN("something")
Title: Re: Function to get a number from a string!?
Post by: azambuja on October 15, 2008, 11:58:26 AM
Hey man!!
Thanks but it does not work. Maybe I am not using it in the right way.

Azambuja
Title: Re: Function to get a number from a string!?
Post by: ger21 on October 15, 2008, 01:43:08 PM
Is it case sensitive? Try Len and not LEN? That's the VBA function. Maybe the script function is different. I'll have to check the docs.
Title: Re: Function to get a number from a string!?
Post by: zealous on October 16, 2008, 03:29:39 AM
I think he meant in Flash and not VB   

This will return the number of your strings length:

Code: [Select]
MyString.length

this will check to see if the digits are 9:

Code: [Select]
if (MyString.length == 9) {
trace("Is 9");
} else {
trace("Is not 9 it is:"+ MyString.length);
}

.....but you can take the code they gave for VB  and run it in flash but you have to do it like this and I dont belive you can split and join in Mach's VB

fscommand("VBMacro" "some VB here")
Title: Re: Function to get a number from a string!?
Post by: ger21 on October 16, 2008, 09:09:10 AM
Oops, didn't see that it was in the Flash section. :)

Thanks Jason
Title: Re: Function to get a number from a string!?
Post by: zealous on October 17, 2008, 04:27:02 AM
NP  :)
Title: Re: Function to get a number from a string!?
Post by: azambuja on October 17, 2008, 07:43:37 AM
Thanks Zealous!!

That worked. Now I can continue to work.

Azambuja