AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
trim (String str [, String left [, String right]]) yoix.string
 
Returns a new string that is a copy of str, but that has all characters contained in left removed from the left end and all characters contained in right removed from the right end. When right is omitted left is applied to both ends of the string. When left and right are omitted whitespace, in this case any character less than or equal to the space character, is removed from from both ends of str. A NULL value for left or right means make no changes to the appropriate end of str.
 
 Example:   The program,
import yoix.stdio.*;
import yoix.string.*;

String s1 = " \001\002\003 XXXyyy yyyXXX \005\006\007 ";
String s2 = "XYZZYnow is the timeXYZZY";

printf("|%S|\n", trim(s1));
printf("|%S|\n", trim(s2, "XYZ"));
printf("|%S|\n", trim(s2, "XYZ", NULL));
printf("|%S|\n", trim(s2, NULL, "XYZ"));
prints
|XXXyyy yyyXXX|
|now is the time|
|now is the timeXYZZY|
|XYZZYnow is the time|
on standard output.
 
 Return:   String
 
 See Also:   substring

 

Yoix is a registered trademark of AT&T Inc.