Hello Guest it is March 29, 2024, 05:22:01 AM

Author Topic: Function to get a number from a string!?  (Read 10584 times)

0 Members and 1 Guest are viewing this topic.

Function to get a number from a string!?
« 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

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Function to get a number from a string!?
« Reply #1 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")
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html
Re: Function to get a number from a string!?
« Reply #2 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

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Function to get a number from a string!?
« Reply #3 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.
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline zealous

*
  •  489 489
  • HI!
    • View Profile
    • Artsoft Solutions
Re: Function to get a number from a string!?
« Reply #4 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")
« Last Edit: October 17, 2008, 04:29:04 AM by zealous »

Offline ger21

*
  • *
  •  6,295 6,295
    • View Profile
    • The CNC Woodworker
Re: Function to get a number from a string!?
« Reply #5 on: October 16, 2008, 09:09:10 AM »
Oops, didn't see that it was in the Flash section. :)

Thanks Jason
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline zealous

*
  •  489 489
  • HI!
    • View Profile
    • Artsoft Solutions
Re: Function to get a number from a string!?
« Reply #6 on: October 17, 2008, 04:27:02 AM »
NP  :)
Re: Function to get a number from a string!?
« Reply #7 on: October 17, 2008, 07:43:37 AM »
Thanks Zealous!!

That worked. Now I can continue to work.

Azambuja