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

Last change on this file since 236 was 232, checked in by pinsard, 17 years ago

improvements/corrections of some *.pro headers

  • 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;-
30; Copyright (C) 1997, Martin Schultz, Harvard University
31; This software is provided as is without any warranty
32; whatsoever. It may be freely used, copied or distributed
33; for non-commercial purposes. This copyright notice must be
34; kept with any copy of this software. If this software shall
35; be used commercially or sold as part of a larger package,
36; please contact the author to arrange payment.
37; Bugs and comments should be directed to mgs@io.harvard.edu
38; with subject "IDL routine strright"
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.