IDL commonly used string processing functions

Source: Internet
Author: User

In the process of remote sensing image processing, the problem of storing data naming is always encountered, and the effective use of IDL string function can achieve the desired effect.

1.file_basename (): Return file name

File = ' F:\data\myfile.img ' title = file_basename (file, '. img ') print,title  >myfile

2.file_dirname (): Returns the folder name

File = ' F:\data\myfile.img ' title = file_dirname (file) print,title  >f:\data

3.STRCMP (): Compare strings for the same

Print, STRCMP (' Moose ', ' Moo ', 3,/fold_case) >1; determine whether the first three of the two strings match, return, 1, or 0   plus the keyword/fold_case case-insensitive

4.STRLEN (): Calculate string length

Print,strlen (' ABCD ') >4

5.STRTRIM (): Remove the space in the string, n=0, means to remove the trailing space, n=1 remove the front space, n=2 front and rear of the fort space are removed

Print,strtrim (' abc ', 0) >abc

6.STRMID (): From the N1 position of the string, remove the N2 characters of the substring, if omitted N2, then read to the end of the string,/reverse_offset refers to from the tail count

Print,strmid ' ABCD ', 0,2) >ab

7.

  

  

IDL commonly used string processing functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.