The type object's `prototype` property can be used to find out which methods a certain type
supports:
- /* This returns: ["contains","find","len","lower","replace","reverse","split","substr","to_string","upper"] */
+ /* This returns: ["contains","find","len","lower","replace","reverse","split","substr","to_string","trim","upper"] */
keys(String.prototype)
Additional documentation on type methods is available in the
Returns a copy of the string in reverse order.
+### <a id="string-trim"></a> String#trim
+
+Signature:
+
+ function trim();
+
+Removes trailing whitespaces and returns the string.
+
## <a id="object-type"></a> Object type
This is the base type for all types in the Icinga application.
return self.Reverse();
}
+static String StringTrim(void)
+{
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
+ String self = vframe->Self;
+ return self.Trim();
+}
+
Object::Ptr String::GetPrototype(void)
{
static Dictionary::Ptr prototype;
prototype->Set("contains", new Function(WrapFunction(StringContains), true));
prototype->Set("replace", new Function(WrapFunction(StringReplace), true));
prototype->Set("reverse", new Function(WrapFunction(StringReverse), true));
+ prototype->Set("trim", new Function(WrapFunction(StringTrim), true));
}
return prototype;