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

Last change on this file since 264 was 262, checked in by pinsard, 17 years ago

corrections of some headers and parameters and keywords case. change of pro2href to replace proidl

  • 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;-
39;
40FUNCTION strright, s, lastn
41;
42  compile_opt idl2, strictarrsubs
43;
44 
45    on_error,2   ; return to caller
46 
47    if (n_elements(s) le 0) then return,-1L
48 
49    l = strlen(s)
50 
51    if (n_elements(lastn) le 0) then lastn = 1
52    if lastn gt l then lastn = l
53 
54    result = strmid(s,l-lastn,l)
55 
56    return,result
57end
Note: See TracBrowser for help on using the repository browser.