source: trunk/SRC/ToBeReviewed/STRING/strright.pro @ 163

Last change on this file since 163 was 163, checked in by navarro, 18 years ago

header improvements : type of parameters and keywords, default values, spell checking + idldoc assistant (IDL online_help)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.4 KB
RevLine 
[2]1;-------------------------------------------------------------
2;+
3;
[142]4; @file_comments
5; return right subportion from a string
[2]6;
[142]7; @categories
[157]8; String
[142]9;
10; @param S {in}{required}
11; the string to be searched
[2]12;
[163]13; @param LASTN {in}{required}{default=1}
14; the number of characters to be returned.
15; If NLAST is the strlen(STRING), the complete string
[142]16; is returned.
[2]17;
[142]18; @returns
19; The portion of LASTN characters of S counted from the back.
[2]20;
[142]21; @examples
22; if (strright(path) ne '/') then path = path + '/'
[2]23;
[142]24; @history
25;        mgs, 19 Nov 1997: VERSION 1.00
[2]26;
[142]27; @version
28; $Id$
[2]29;
30;-
31; Copyright (C) 1997, Martin Schultz, Harvard University
32; This software is provided as is without any warranty
33; whatsoever. It may be freely used, copied or distributed
34; for non-commercial purposes. This copyright notice must be
35; kept with any copy of this software. If this software shall
36; be used commercially or sold as part of a larger package,
37; please contact the author to arrange payment.
38; Bugs and comments should be directed to mgs@io.harvard.edu
39; with subject "IDL routine strright"
40;-------------------------------------------------------------
41
42
43function strright,s,lastn
[114]44;
45  compile_opt idl2, strictarrsubs
46;
[2]47 
48    on_error,2   ; return to caller
49 
50    if (n_elements(s) le 0) then return,-1L
51 
52    l = strlen(s)
53 
54    if (n_elements(lastn) le 0) then lastn = 1
55    if lastn gt l then lastn = l
56 
57    result = strmid(s,l-lastn,l)
58 
59    return,result
60end
Note: See TracBrowser for help on using the repository browser.