[Toc][Index]

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 || ">"


  

Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs