REXX Tips & Tricks, Version 2.80


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


Get the first and the last char of a string




You can use PARSE also to split a string into first char, last char and 
all chars between the first and the last char. 
Example: 

 
/* split a string into first char, last char, and the chars between   */
/* (assuming the last char is unique in the whole string)             */

  nextLine = "[TestSection]"
  parse var nextline firstChar +1 . "" -1 lastChar,
                     1 (firstChar) SectionName (lastChar)

  say "The first char is <" || firstChar || ">"
  say "The last char is <" || lastChar || ">"
  say "The chars beteween are <" || sectionName || ">"


  

Inf-HTML End Run - Successful