AmigaOS 4.0 - About OS4 - Commands
|
||||||||
|
||||||||
|
CUT will extract any number of characters or words out of a string.
The extracted string is defined by a begin and an end position. Those values will be characters or words positions in the original string, i.e you may want to extract a string beginning with a character at position P1 and ending with a character at position P2. Behaviour is the same with words instead of characters. Use the CHAR argument if you want to use begin/end values defined in characters. Use the WORD argument if you want to extract any number of words. Words are strings separated by the "space" character (default). Using the SEPARATOR argument, you can specify a string of any length to be used to split the original string in words. The length of the string to extract will depend on the begin (P1) and the end (P2) position in the original string. This P1-P2 range to give after the CHAR (or WORD) argument follows the template: P1[-P2] | [P1-]P2 | [P1]-P2 | P1-[P2] The begin (P1) and end (P2) values are optional. This allows to extract only one character (or word) if you omit the end value. i.e with the argument like "CHAR P1" In order to extract several characters (or words), you need to specify a range with the "-" character like "CHAR P1-P2" You can omit P1 if you want a string starting at the beginning of <string> with "CHAR -P2". And you do not need to know the string length because P2 can be omitted like "CHAR P1-". This will extract the string beginning with character at position P1 and ending at the end of the original <string>. Example 1: e Example 2: Hello Example 3: Hello Example 4: world Example 5: He
Disclaimer: Amiga Auckland have prepared the above information for the use of its members based on our experiences and as such is subject to revision at any time. Amiga Auckland cannot guarantee any of the information and cannot be held accountable for any issues that may result from using it. |