Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Macro name changed from html to html-bobswift during server to cloud migration processing.
Panel
Table of Contents

Anchor
1156709
1156709
Syntax

substring variable_name string {pos=position | startseq=sequence [startseqnum=number]} {length=length | endseq=sequence [endseqnum=number]} [case=yes|no]

Anchor
1156714
1156714
Description

...

Anchor
1156717
1156717
The beginning of the substring is marked either by a position or a start sequence and optional sequence occurrence number (similar to deletestring). The end of the substring is determined by specifying the length of the substring or an ending sequence and optional sequence occurrence number, also similar to deletestring.

The case parameter specifies whether comparisons for start and end sequences are case sensitive (yes) or case insensitive (no). [Default is no.]

Anchor
1156725
1156725
_lastrc.message is set to NO_MATCH if a start or end sequence was specified and could not be found. If the position or length are specified and contain invalid values, _lastrc.message will contain INVALID_VALUE.

...

Anchor
1156774
1156774
The following examples illustrate the substring command:

Panel
Html bobswift
<pre>
substring res "This is fun" pos=6 length=2
echo "$(res)"
is

substring res "This is less fun" startseq=" " endseq=" "
echo "$(res)"
is

substring res "This This is fun fun" startseq=" " endseq=" " +
          endseqnum=3
echo "$(res)"
This is fun
</pre>

Anchor
1154381
1154381