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

Last change on this file since 372 was 325, checked in by pinsard, 17 years ago

modification of some headers (+some corrections) to prepare usage of the new idldoc

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