SketchUp  Ruby API Reference 

Class Index

Method Index

Developers Guide

Examples

String Class

 The String class contains a method used to parse a string as a length value. 

Parent: Object

Methods: to_l

Example Code: stringtests.rb

Instance Methods


to_l

The to_l method is used to parse a string and returns a length value.

Syntax

length = str.to_l 

Return Value

length - a length value in current units if successful

Example

teststring = "3.2m"
begin
len = teststring.to_l
rescue
UI.messagebox $!.message
end
if (len)
UI.messagebox len
else
UI.messagebox "Failure"
end