EXTRACT Function

M言語プログラミングブック [WALTERS1997] から引用

Page 65.

コマンド

$EXTRACT(target[,start[,end]])

Description

$EXTRACT(target[,start[,end]]) takes a string and two optional integers as arguments and returns a substring.

  • Returns the first character of the target string if the start argument is omitted.
  • If start or end are out of bounds then it returns only valid characters from the target string.
  • If end < start then it returns "".

; Writes "T"
S X=$EXTRACT("Thomas Rozanski") W X

; Writes "o"
S X=$EXTRACT("Thomas Rozanski",3) W X

; Writes nothing
S X=$EXTRACT("Thomas Rozanski",0) W X

; Writes nothing
S X=$EXTRACT("Thomas Rozanski",999) W X

; Writes "Thomas Rozanski"
S X=$EXTRACT("Thomas Rozanski",0,999) W X

; Writes "Tho"
S X=$EXTRACT("Thomas Rozanski",1,3) W X

; Writes nothing
S X=$EXTRACT("Thomas Rozanski",3,1) W X

Table Of Contents

Previous topic

DATA Function

Next topic

FIND Function

This Page

inserted by FC2 system