STRCMP IDL routine to compare text in one string to another STRPOS IDL routine to test for the existence of a substring within a string STRMATCH IDL routine that will test for strings that match certain patterns STRMID IDL routine that will return a substring from a string STRWHERE GAMAP routine that returns the locations of a single character within a string RSEARCH GAMAP routine to look for text in a string starting from the end of the string STRRIGHT GAMAP routine that returns the last N characters from a string The following routines can be used to locate text within a string variable: IDL> str = 'hello' + string(tab) + 'world'įor more information about IDL's string functions, please see. For example, the horizontal tab character is the 9th character in the ASCII table, so we may specify that as: We must specify some special non-printing ASCII characters with their byte value. Note that we used IDL's STRLEN function to return the length of the string. IDL> byte_array = str2byte( str, strlen( str ) ) This allows you to take a text string and to convert it into the equivalent array of bytes. GAMAP comes with a very useful routine called STR2BYTE. If you have an array of bytes, you can use any of the IDL string routines on them, for example:
This means that it is easy to convert between strings and bytes in IDL. (Actually, the original ASCII table had 128 values, but this was later extended to 255 values to include special characters.) One byte represents a single ASCII text character. The ASCII collating sequence has 255 values. A byte is a collection of 8 bits and may express values from 0-255. In IDL, a string of text characters is equivalent to an array of byte values. You can use IDL's STRTRIM function to strip the leading and trailing whitespace. Create a new string by concatenating 2 strings by concatenating one string with another.
by parsing a number with IDL's STRING function.by placing text between single and double quotes.We may form a string of text characters in IDL in the following ways: String basics Creating text and numeric strings 7 Functions for working with file and path names.1.2 Equivalence of strings and byte arrays.